Skip to content

Conversation

vasayxtx
Copy link
Contributor

@vasayxtx vasayxtx commented Oct 1, 2025

TLDR

This fixes the "-32601: tools not supported" error that occurs when connecting to MCP servers that only provide prompts (no tools).

Dive Deeper

Similar to how discoverPrompts() checks for prompt support:
if (mcpClient.getServerCapabilities()?.prompts == null) return [];

The discoverTools() function should check for tool support before attempting to call mcpToTool(), and silently return an empty array if tools are not supported.

Reviewer Test Plan

Connect to an MPC server which doesn't implement the tools/list handler, you will no longer see an error on startup (but would previously).

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

Fixes #10365

- Add capability check in discoverTools() before calling mcpToTool()
- Return empty array when server does not advertise tool support
- Follow same pattern as discoverPrompts() capability check
- Add tests to verify tools are only discovered when server supports them
- Update existing tests to mock getServerCapabilities() properly

This fixes the "-32601: tools not supported" error that occurs when
connecting to MCP servers that only provide prompts (no tools).
@vasayxtx vasayxtx requested a review from a team as a code owner October 1, 2025 20:36
Copy link
Contributor

Summary of Changes

Hello @vasayxtx, 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 addresses an issue where the MCP client would encounter an error when attempting to discover tools on servers that are configured to only support prompts. By introducing a pre-check for server capabilities within the discoverTools() function, the client now intelligently skips tool discovery if the server explicitly indicates no tool support, thereby preventing errors and improving the overall stability and compatibility with diverse MCP server configurations.

Highlights

  • Error Prevention: Implemented a check in the discoverTools() function to prevent a "-32601: tools not supported" error when connecting to MCP servers that only provide prompt capabilities and do not support tools.
  • Robustness Improvement: Ensures that the client gracefully handles servers lacking tool support by silently returning an empty array for tool discovery, mirroring the existing behavior for prompt discovery.
  • Enhanced Test Coverage: Added new unit tests to mcp-client.test.ts to explicitly verify the correct behavior of tool discovery, covering scenarios where servers either support or do not support tools.
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
Contributor

@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 correctly fixes an error that occurred when connecting to prompt-only MCP servers. The change adds a check for tool support in discoverTools before proceeding, which is consistent with how discoverPrompts works. The accompanying tests are well-written, covering both scenarios where a server supports tools and where it does not. The changes are sound and address the issue effectively.

@vasayxtx
Copy link
Contributor Author

vasayxtx commented Oct 2, 2025

The CI failures appear to be flaky tests - both fail at interactive mode startup, which is unrelated to my MCP capability checking changes. @scidomino, could you re-run the failed jobs? Thanks!

@scidomino
Copy link
Collaborator

There was a flakey test fix that was checked in recently that you didn't have. I updated your branch and am running them again.

@scidomino scidomino enabled auto-merge October 2, 2025 19:45
@scidomino scidomino added this pull request to the merge queue Oct 2, 2025
Merged via the queue into google-gemini:main with commit 0c6f9d2 Oct 2, 2025
19 checks passed
skeshive pushed a commit that referenced this pull request Oct 2, 2025
skeshive pushed a commit that referenced this pull request Oct 2, 2025
thacio added a commit to thacio/auditaria that referenced this pull request Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MCP servers with only prompts (no tools) cause "tools not supported" error
2 participants