fix(mcp): keep codegraph_explore loaded in Claude Code and Copilot CLI - #1697
Open
bompus wants to merge 1 commit into
Open
fix(mcp): keep codegraph_explore loaded in Claude Code and Copilot CLI#1697bompus wants to merge 1 commit into
bompus wants to merge 1 commit into
Conversation
colbymchenry#1696) Claude Code defers every MCP tool behind ToolSearch by default, so a fresh session sees only the tool name until the model searches for it. The explore tool now carries `_meta: { "anthropic/alwaysLoad": true }`, which exempts it on existing installs, and the Claude Code installer target writes `alwaysLoad: true` on the server entry (re-running install adds the key to an older entry). Copilot CLI tool search holds MCP tools back the same way once ~30 tools are connected, so its entry carries `deferTools: "never"`.
Contributor
|
Merged into a local integration build of current |
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.
Fixes #1696.
Claude Code defers every MCP tool behind its
ToolSearchstep by default, so a fresh session sees onlycodegraph_explore's name until the model searches for it. On a defaultcodegraph installsetup with no project rule naming the tool, 4 of 6 headless Opus sessions never called it and did the task with Grep/Read; with the schema in context from the first turn, 6 of 6 did (numbers and the reproduction in #1696).Change
codegraph_explorecarries_meta: { "anthropic/alwaysLoad": true }insrc/mcp/tools.ts, andToolDefinitiongains an optional_meta. Claude Code reads the key and keeps the tool's schema loaded from the first prompt. It reaches an existing install on upgrade without touching the user's config; other hosts ignore_meta."alwaysLoad": trueon the server entry (src/installer/targets/claude.ts), on both the project.mcp.jsonand the global~/.claude.jsonpath. Re-runningcodegraph installadds the key to an entry that predates it. The README's manual~/.claude.jsonsnippet shows the key."deferTools": "never"on its entry (src/installer/targets/copilot-cli.ts). Copilot CLI's tool search defers MCP tools once ~30 tools are connected, and that key is its per-server opt-out (docs). Docs-verified only; the host is not installed here.mcp-tool-annotations.test.tsasserts the_metaon everytools/listsurface (the master array,getStaticTools(),ToolHandler.getTools(), and the live server);installer-targets.test.tscovers the key on the Claude project and global paths, the Copilot CLI entry, and the re-run migration for both.Verified
--strict-mcp-configwith the plain entry: the released 1.6.0 server runsToolSearchthencodegraph_explore; this branch's build runscodegraph_explorealone.vitest: 233 passed, 3 skipped.tscclean.Not in this PR
OpenCode 2's Code Mode, which puts MCP tools behind a code interface by default. Its per-server opt-out,
"codemode": false, only survives on the native v2 entry shape, which the installer does not write yet. Separate issue to follow.