fix(mcp): disclose that Plan Mode read-only status is a server claim - #28549
fix(mcp): disclose that Plan Mode read-only status is a server claim#28549cybrdude wants to merge 4 commits into
Conversation
Carries the server-supplied readOnlyHint claim through to the confirmation so it can be disclosed to the user. The value is not verified by Gemini CLI.
Reads readOnlyHint off the tool annotations the MCP server supplied and passes it to the confirmation details.
Adds one line to the MCP confirmation when the server declared the tool read-only, stating that Gemini CLI has not verified the claim. Mirrors the existing exec warning pattern, including the extraInfoLines height accounting.
Asserts the flag tracks the server-supplied readOnlyHint annotation and nothing else: true when declared, false when declared false, false when absent.
Summary of ChangesHello, 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 improves user security awareness regarding MCP tools by surfacing server-provided read-only claims during the approval process. By clearly distinguishing between a server's declaration and the CLI's verification status, it helps users make more informed decisions when approving tool execution in Plan Mode without altering existing default behaviors or trust models. 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 the 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 counterproductive. 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. Footnotes
|
|
📊 PR Size: size/M
|
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
There was a problem hiding this comment.
Code Review
This pull request adds support for identifying and displaying a warning when an MCP tool is declared as read-only by the server. It updates the ToolConfirmationMessage component to display an unverified read-only claim notice, adds the serverDeclaredReadOnly property to the confirmation details, and includes comprehensive unit tests to verify this behavior. I have no feedback to provide as the implementation is correct and complete.
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
|
Flagging the 7-day auto-close notice above, since this PR came out of a Google The finding was reported through the Google VRP as b/524448710. It was closed Because of that path, there was no pre-existing "help wanted" issue to attach On the change itself, in case it helps triage decide quickly:
If the team would rather take a different shape here, I am happy to adapt it. I |
|
This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
Closes #28548.
Summary
Plan Mode presents itself as read-only, and for MCP tools that decision rests on the
readOnlyHintannotation the MCP server supplies about itself. Gemini CLI does not verify it, andplan.tomlpromotes any tool carrying it out of the Plan Mode deny-all intoask_user. A server therefore decides which of its own tools Plan Mode will surface, including a destructive one.The confirmation prompt still fires, so this is not silent execution. But the prompt never tells the user that the read-only status is a server claim, while Plan Mode's own messaging tells them Plan Mode is read-only. The approval prompt is the control that catches this case, so it should carry the doubt.
Reported to Google VRP as b/524448710 (closed Won't Fix / Infeasible, P2 / S4). Triage confirmed on 2026-07-27 that a public PR is welcome.
What this changes
When an MCP tool is presented for confirmation and the server declared it read-only, the prompt now says so and states that Gemini CLI has not verified the claim. One extra line, shown only when the annotation is present.
packages/core/src/tools/tools.ts: adds optionalserverDeclaredReadOnlytoToolMcpConfirmationDetails.packages/core/src/tools/mcp-tool.ts: populates it from the server-suppliedreadOnlyHintannotation.packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx: renders the disclosure. This mirrors the existingexecredirection-warning pattern, including theextraInfoLinesheight accounting so the layout math stays correct.packages/core/src/tools/mcp-tool.test.ts: asserts the flag tracks the annotation and nothing else (true when declared, false when declared false, false when absent).What this deliberately does not change
The
plan.tomlpromotion stays. Removing it would deny all MCP tools in Plan Mode and undo the MCP-in-Plan-Mode support from #18229 and the annotation matching from #19671 / #20029 / #20083. No defaults change, no new config surface, no behavior change for servers that do not send the annotation.Follow-up available on request
Gate the promotion on user-side trust: honor
readOnlyHintin Plan Mode only for servers the user has explicitly marked trusted, and treat MCP tools as non-read-only in Plan Mode otherwise. Stronger boundary, but it changes default behavior for existing MCP users, so I kept it out of this PR. Happy to build it if you prefer that shape.For context, #27156 and #27163 asked for the opposite, trusting
readOnlyHintenough to auto-allow annotated tools in Plan Mode, and both were closed. This change is consistent with that outcome.Testing note
Unit tests are included. I do not have a full local build of the monorepo, so CI here is the first complete typecheck, lint, and test run. Happy to fix up anything it flags.