-
Notifications
You must be signed in to change notification settings - Fork 23
fix: normalise tool names to underscores for Cursor compatibility #169
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
base: main
Are you sure you want to change the base?
fix: normalise tool names to underscores for Cursor compatibility #169
Conversation
Summary of ChangesHello @m0nkmaster, 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 a compatibility issue with Cursor IDE where tool calls were failing due to a mismatch in tool naming conventions. By intercepting the tool registration process, the server now automatically normalizes tool names, converting dots to underscores, to align with how Cursor IDE invokes these tools. This change ensures seamless integration with Cursor IDE while maintaining backward compatibility for other clients. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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 addresses an incompatibility with Cursor IDE by normalizing tool names at registration, replacing dots with underscores. The implementation involves monkey-patching the server.registerTool method. While the approach is functional, my review includes a suggestion to refactor the patch to preserve TypeScript's type safety, which is currently compromised by the new implementation. Additionally, a new section in the development documentation clarifies this new naming convention.
|
Thanks for the review feedback @gemini-code-assist! The type safety concern has been addressed - the implementation now uses |
|
That's excellent news, @m0nkmaster! Using Thank you for the quick and thorough update! |
a89be7d to
ca45e84
Compare
ca45e84 to
797e257
Compare
|
I think we'll need a different approach here. This would be a breaking change for people who have written gemini cli policies against the current tool names, as well as anyone who has written custom slash commands that rely on our MCP names (it would also break the slash commands that we ship in the extension). I think a better approach would be to ship an adapter that is controlled by a command line flag so that our current names are the default and the command line flag can shift the names to use an _ instead. |
Summary
Fixes #168
Cursor IDE converts dots (
.) to underscores (_) when invoking MCP tools. This causes all tool calls to fail withTool not founderrors because the server registers tools with dots (e.g.,docs.find) but Cursor calls them with underscores (e.g.,docs_find). 🤷♂️Changes
server.registerToolto normalise tool names (dots → underscores) at registration timeBackwards Compatibility
This change is backwards-compatible. Clients that preserve dots (VS Code, Gemini CLI) will continue to work because underscores are valid characters in tool names for all MCP clients.
Testing