-
-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Fix: Add reset timeout option for MCP tool requests #5491
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?
Conversation
Refactor tool initialization and request handling to include reset timeout on progress (resetTimeoutOnProgress=true) when a new env variable MCP_RESET_TIMEOUT_ON_PROGRESS=true.
Summary of ChangesHello @nzmarktaylor, 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 enhances the MCP tool integration by allowing for dynamic timeout management during long-running server processes. It refactors the tool initialization and request handling to incorporate a 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 a resetTimeoutOnProgress option for MCP tool requests, which is a valuable addition for handling long-running server processes. The implementation correctly uses an environment variable for configuration to ensure backward compatibility. However, my review identified a critical typo that would cause a runtime error, and an instance of code duplication that should be refactored to improve maintainability. Addressing these points will strengthen the implementation.
While preparing the change for the PR a copy and paste error was introduced, this commit is just to fix the critical issue caused by that
Optimize environment variable usage for DRY principles - to address gemini-code-assist request
|
@gemini-code-assist can you please review the code for the PR again, I have addressed the issues you found. |
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 a resetTimeoutOnProgress option for MCP tool requests, controlled by the MCP_RESET_TIMEOUT_ON_PROGRESS environment variable. The changes look good overall, but I've found an inconsistency in how the new options are applied. In one place, a required callback is missing, which could lead to unexpected timeouts. My review includes a suggestion to fix this.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Refactor tool initialization and request handling to include reset timeout on progress (resetTimeoutOnProgress=true) when a new env variable MCP_RESET_TIMEOUT_ON_PROGRESS=true.
Some MCP servers with long-running processes provide progress feedback that allows the client to know that the server is still working on the request, this progress resets the timeout counter allowing for longer calls. To support this we need to provide resetTimeoutOnProgress=true and a callback method, when making calls to MCP tools.
To ensure backwards compatibility we have wrapped this change with an environment variable called MCP_RESET_TIMEOUT_ON_PROGRESS, which defaults to false (no effect on existing implementations), but when set to 'true' it will allow timeout resets for MCP servers that provide progress reports.