Repository navigation
fix(tools): don't trust readOnlyHint in isReadOnly for unloaded MCP tools - #2057
Merged
Merged
Conversation
Contributor
No changeset foundThis PR does not add a changeset, so it will not appear in the changelog or trigger a release. If the change is user-facing, add one: pnpm changesetPick a bump (patch / minor / major) and write the changelog entry in our usual voice ("Added X... Thanks to @you. Closes #123."), then commit the generated If this PR is docs-only or a chore that needs no release note, you can ignore this — or run |
Contributor
|
nc-review could not produce a verdict this run (agent exit |
…ools ToolManager.isReadOnly fell back to the catalog entry for an on-demand MCP tool whose schema wasn't loaded, and that entry's readOnly is the server's own readOnlyHint. isReadOnly decides checkpoint capture and parallel batching, which the hint must not influence. The same tool was also not read-only once loaded, so the answer flipped on load. Read only the registry entry. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
will-lamerton
force-pushed
the
fix/mcp-unloaded-readonly-hint
branch
from
November 11, 2026 15:03
05834f4 to
05afc2e
Compare
jay23606
added a commit
to jay23606/nanocoder
that referenced
this pull request
Nov 12, 2026
…ools (Nano-Collective#2057) ToolManager.isReadOnly fell back to the catalog entry for an on-demand MCP tool whose schema wasn't loaded, and that entry's readOnly is the server's own readOnlyHint. isReadOnly decides checkpoint capture and parallel batching, which the hint must not influence. The same tool was also not read-only once loaded, so the answer flipped on load. Read only the registry entry. Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
diyaavirmani
added a commit
to diyaavirmani/nanocoder
that referenced
this pull request
Nov 16, 2026
Conflicts with on-demand MCP discovery (Nano-Collective#1651, Nano-Collective#2052, Nano-Collective#2057): - tool-manager.ts: kept discovery, the catalog and outage recovery, with this branch's registration rule on every path. A name a built-in, custom or skill tool has is skipped from the catalog too, so load_tool_schema can't offer the MCP schema for it, and loadMcpTool won't claim it. Tools loaded on demand are tracked, so an outage or a disconnect removes them and never the built-in. - daemon/entry.ts, plain/initialize.ts: pass upstream's tune config and keep the skipped-tools warning. - Specs: kept both sides; setGlobalMessageQueue moved to @/components/message-queue (Nano-Collective#2155), and the custom-tools stand-in client now maps its tool, which initializeMCP reads.
11 of 18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ToolManager.isReadOnly()decides two things: whether ACP takes a checkpoint before a call (acp-timeline.ts) and whether calls can run in parallel (tool-executor.tsx). For an on-demand MCP tool whose schema wasn't loaded yet, it fell back to the catalog entry. That entry'sreadOnlyis the server's ownreadOnlyHint, so:MCPClient.getToolEntriesand indocs/configuration/mcp-configuration.md, which say the hint "never suppresses a checkpoint before the call, and never promotes the tool into a parallel batch"truewhile unloaded, thenfalseonce loaded, because the registry entry has noreadOnlyflagHow reachable it is: on current main, the conversation, plain and ACP loops reject a call to an unregistered tool before they reach
isReadOnly, so I couldn't trigger this end to end today. It's a latent trap: any path that hydrates on call (getToolHandlerandgetToolEntryalready do) would let a server's hint skip a checkpoint. The fix is one line, so I've put it up rather than leave it.Fix:
isReadOnlyreads only the registry entry. The catalog still shows[read-only]to the model, and plan-mode filtering still reads the hint from the client's tool mapping, as before.Split out of the discovery-reconnect fix (#2052) because it's a separate concern.
Type of Change
Changeset
No changeset: nothing a user can observe changes today (see above).
Testing
New test in
source/tools/tool-manager.spec.ts. It uses a fake client through thecreateMCPClient()seam, with tools annotatedreadOnly: trueandmcpDiscovery: "always":isReadOnlyisfalsebefore loading and after loadingread_fileis still read-onlyIt fails on main ("an unloaded tool must not be read-only on the server hint alone") and passes with the fix.
tsc --noEmitand biome are clean. AVA passes forsource/tools/**,source/hooks/chat-handler/**andsource/acp(982 tests).🤖 Generated with Claude Code