Skip to content

fix(aws-diagram-mcp-server): use str for diagram_type param for Gemini compatibility#2430

Merged
MichaelWalker-git merged 3 commits into
mainfrom
fix/gemini-schema
Feb 16, 2026
Merged

fix(aws-diagram-mcp-server): use str for diagram_type param for Gemini compatibility#2430
MichaelWalker-git merged 3 commits into
mainfrom
fix/gemini-schema

Conversation

@MichaelWalker-git

@MichaelWalker-git MichaelWalker-git commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Change get_diagram_examples tool's diagram_type parameter from DiagramType enum to str so the generated JSON schema includes "type": "string"
  • Gemini requires an explicit "type" field in tool parameter schemas and rejects function calls when it's missing (the enum-based schema omits it)
  • Convert the string to DiagramType internally, falling back to ALL for unrecognized values
  • Add TestMcpGetDiagramExamplesStringInput test class with 4 tests covering plain string input, invalid input fallback, and all valid enum values

Closes #661

Test plan

  • All 13 server tests pass (9 existing + 4 new)
  • ruff check and ruff format clean
  • pyright clean (0 errors)
  • Verify with Gemini backend that get_diagram_examples tool is now callable

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

…for Gemini compatibility

The get_diagram_examples tool's diagram_type parameter used a
DiagramType(str, Enum) which does not emit "type": "string" in the
JSON schema. Gemini requires an explicit "type" field in tool
parameter schemas and rejects calls without it.

Change the parameter type to str with a default of 'all' so the
schema includes "type": "string". Convert to DiagramType internally,
falling back to ALL for unrecognized values.

Closes #661
@MichaelWalker-git MichaelWalker-git requested a review from a team as a code owner February 13, 2026 18:41
Copilot AI review requested due to automatic review settings February 13, 2026 18:41
@MichaelWalker-git MichaelWalker-git requested a review from a team as a code owner February 13, 2026 18:41
@codecov

codecov Bot commented Feb 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.86%. Comparing base (1e17784) to head (3a7c5c6).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2430   +/-   ##
=======================================
  Coverage   90.86%   90.86%           
=======================================
  Files         974      974           
  Lines       71139    71143    +4     
  Branches    11546    11546           
=======================================
+ Hits        64638    64642    +4     
  Misses       3984     3984           
  Partials     2517     2517           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/aws-diagram-mcp-server/tests/test_server.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a compatibility issue with Gemini backends by changing the get_diagram_examples tool's diagram_type parameter from a DiagramType enum to a plain str type. The Gemini backend requires an explicit "type" field in the JSON schema for tool parameters, which is omitted when using enum types. The change ensures the generated schema includes "type": "string", making the tool callable from Gemini environments.

Changes:

  • Modified diagram_type parameter from DiagramType enum to str with internal conversion to maintain type safety
  • Updated default value from DiagramType.ALL to string 'all'
  • Added fallback logic to use DiagramType.ALL for unrecognized string values
  • Added comprehensive test suite covering string input, invalid values, and all valid enum values

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/aws-diagram-mcp-server/awslabs/aws_diagram_mcp_server/server.py Changed mcp_get_diagram_examples parameter type to str, added string-to-enum conversion with fallback
src/aws-diagram-mcp-server/tests/test_server.py Added TestMcpGetDiagramExamplesStringInput test class with 4 tests covering string inputs and edge cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Address code quality bot warning about iterating over a type by
wrapping DiagramType in list() to make the iteration explicit.

@scottschreckengaust scottschreckengaust left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MichaelWalker-git MichaelWalker-git added this pull request to the merge queue Feb 16, 2026
Merged via the queue into main with commit 920ed40 Feb 16, 2026
224 checks passed
@MichaelWalker-git MichaelWalker-git deleted the fix/gemini-schema branch February 16, 2026 17:36
@github-project-automation github-project-automation Bot moved this from To triage to Done in awslabs/mcp Project Feb 16, 2026
massi-ang pushed a commit to massi-ang/aws-mcp that referenced this pull request Feb 19, 2026
…i compatibility (awslabs#2430)

* fix(aws-diagram-mcp-server): use str type for diagram_type parameter for Gemini compatibility

The get_diagram_examples tool's diagram_type parameter used a
DiagramType(str, Enum) which does not emit "type": "string" in the
JSON schema. Gemini requires an explicit "type" field in tool
parameter schemas and rejects calls without it.

Change the parameter type to str with a default of 'all' so the
schema includes "type": "string". Convert to DiagramType internally,
falling back to ALL for unrecognized values.

Closes awslabs#661

* fix: use list() to explicitly iterate DiagramType enum in test

Address code quality bot warning about iterating over a type by
wrapping DiagramType in list() to make the iteration explicit.
ibrahimcesar pushed a commit to ibrahimcesar/mcp that referenced this pull request Jun 2, 2026
…i compatibility (awslabs#2430)

* fix(aws-diagram-mcp-server): use str type for diagram_type parameter for Gemini compatibility

The get_diagram_examples tool's diagram_type parameter used a
DiagramType(str, Enum) which does not emit "type": "string" in the
JSON schema. Gemini requires an explicit "type" field in tool
parameter schemas and rejects calls without it.

Change the parameter type to str with a default of 'all' so the
schema includes "type": "string". Convert to DiagramType internally,
falling back to ALL for unrecognized values.

Closes awslabs#661

* fix: use list() to explicitly iterate DiagramType enum in test

Address code quality bot warning about iterating over a type by
wrapping DiagramType in list() to make the iteration explicit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

aws-diagram-mcp-server: Gemini backend rejects tool registration due to missing schema type

4 participants