Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Fix issue with MCP tools throwing an error. #3083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nickvander wants to merge 0 commits into google:main from nickvander:main

Conversation

@nickvander
Copy link

@nickvander nickvander commented Oct 3, 2025
edited
Loading

Problem

When an MCP tool is resolved using _gemini_schema_util.py, if it has an array it wasn't correctly resolving them and showing an error:

GenerateContentRequest.tools[0].function_declarations[1].parameters.properties[segmentation_classes].items: missing field

Root Cause

The error "parameters.properties[segmentation_classes].items: missing field" indicates _to_gemini_schema isn't correctly handling array types.

Implementation Details

Correctly handle array types by adding a default items field of {"type": "string"} to schemas with type: array but no items field.

Fixes: #3082

Copy link

Summary of Changes

Hello @nickvander, I'm Gemini Code Assist1 ! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical bug that prevented MCP tools from correctly processing schemas containing array types. Previously, if an array was defined without an explicit items field, the system would fail with a 'missing field' error. The change introduces logic to automatically assign a default {"type": "string"} to the items field for any array type lacking this definition, thereby ensuring proper schema resolution and preventing runtime errors.

Highlights

  • Error Resolution: Fixes an issue where MCP tools would throw an error when resolving schemas containing array types that lacked an explicit 'items' field.
  • Schema Handling for Arrays: Ensures that schemas with type: array but no items field are correctly processed by automatically assigning a default {"type": "string"} to the items field.
  • Targeted Change: The modification is implemented within the _sanitize_schema_type function in _gemini_schema_util.py to address both inferred and directly specified array types.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Collaborator

adk-bot commented Oct 3, 2025

Response from ADK Triaging Agent

Hello @nickvander, thank you for creating this PR!

To help us review this bug fix efficiently, could you please provide the following information based on our contribution guidelines?

  • Associated Issue: Please create and link a GitHub issue that this PR addresses.
  • Testing Plan: Could you add a testing plan section to your PR description explaining how you've tested these changes?
  • Verification: It would be helpful to include logs or screenshots demonstrating the fix in action.

You can find more details in our contribution guidelines. Thanks!

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request fixes an issue where MCP tools would error on schemas with array types that were missing an items field. The change correctly adds a default items field. However, the implementation introduces some code duplication. My review includes a suggestion to refactor the code to remove this duplication, which will improve the long-term maintainability of this function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@seanzhou1023 seanzhou1023 Awaiting requested review from seanzhou1023

1 more reviewer

@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

mcp [Component] Issues about MCP support

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Missing field when using some MCP servers

AltStyle によって変換されたページ (->オリジナル) /