-
Notifications
You must be signed in to change notification settings - Fork 18.5k
feat: add inputs parameter to MCP tool invocation methods #28306
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?
feat: add inputs parameter to MCP tool invocation methods #28306
Conversation
Summary of ChangesHello @zinodynn, 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 significantly enhances the functionality of Multi-Chain Protocol (MCP) tools by allowing the forwarding of extra parameters, referred to as 'inputs,' from chat requests. This new capability provides a robust mechanism for implementing advanced business logic within MCPs, such as user authentication and fine-grained access control, by leveraging contextual information from the initial chat request. The change improves the overall adaptability and power of the tool invocation system. Highlights
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 introduces an inputs parameter to the MCP tool invocation methods, enabling additional variables from chat requests to be passed to MCP servers. This is a valuable enhancement for implementing features like request-side identity verification and permission control. The changes are well-implemented, propagating the new parameter through the necessary layers from fc_agent_runner to ToolEngine and the base Tool class. The use of introspection in the base Tool to conditionally pass the inputs parameter is a good design choice for flexibility. I have identified one high-severity bug that could cause a runtime error and one medium-severity suggestion for improving exception handling. After addressing these points, the PR should be in great shape.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Support the protocol-reserved `_meta` parameter for tool invocations, enabling metadata (e.g., progressToken, identityToken) transmission as specified in MCP spec. See: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/draft/basic/index.mdx#general-fields
|
@Nov1c444, to prevent every MCP from receiving the parameters, would it be a good idea to distinguish parameters in |

Important
Fixes #<issue number>.Summary
feat: Forward chat input variables to MCP server via
_metainputsto MCP servers, facilitating use cases like identity verification and permission control.feat: Support MCP protocol-reserved
_metaparameter in tool invocations_metafield toCallToolRequestParamsto comply with the MCP specification, enabling transmission of metadata such asprogressTokenoridentityToken.These changes improve flexibility for MCP-level business logic, allowing for more fine-grained control and context-aware processing based on upstream chat request details.
References:
Screenshots
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods