Repository navigation
CTX7-3596: Make the MCP server instructions direct so agents call Context7 more often - #3665
fahreddinozcan wants to merge 13 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
ramazanoacar
left a comment
There was a problem hiding this comment.
Thanks Fahreddin, great result. Going from 29% to 79–84% with 0/50 wrong calls is a big jump, and the benchmark table makes the case on its own. Triggering on what the answer contains rather than on the question topic is a smart framing, and keeping library names out means every user sees the same text. Approving 👍
Small notes (non-blocking)
- "ALWAYS follow these steps: 1. Call
resolve-library-id" drops the exception the tool descriptions have ("unless the user gives an/org/projectID"). Adding "unless the user already gave a library ID" to step 1 would save a call in those cases. - The old "Prefer this over web search for library docs" line is gone. In clients that have web search, that was the nudge away from it, so it might be worth keeping as one short sentence.
- Length: about 1.7k characters, plus about 290 for the feedback instructions in research preview, so roughly 2k. That fits Claude Code's current 4,096 limit, but versions before v2.1.296 cut server instructions at 2,048, so any later addition would cut the feedback line first on older installs. Something to keep in mind when this text grows.
…th the tool descriptions
…priority to the server instructions
fahreddinozcan
left a comment
There was a problem hiding this comment.
Reviewed latest head b633458. No blocking code findings. All 274 MCP tests pass locally, including transport parity, research-preview gating, the 2048-character limit, and alwaysLoad metadata. The 1695-character text matches the benchmark c2 fixture exactly. No 4096-character claims were found in tracked Markdown or MDX. Existing approval is on ab35cb4, so a reviewer other than the author must approve the latest head. Accepted release follow-up: many-library prompts can exceed three calls per tool; rerun trigger-eval-many.json when addressing this. Linear issue creation is blocked by expired connector authentication. Benchmark rerun results will follow in a formal review.
fahreddinozcan
left a comment
There was a problem hiding this comment.
Benchmark verification complete on the unchanged c2 text, which exactly matches this head. Claude Code Opus 5.5: 24/24 required calls, 1/25 extra calls on the 49-prompt behavior set, no runner errors, no disconnected MCP servers, and no failed behavioral checks. The extra lookup concerns express.json in a follow-up that adds JSON body parsing; retained the original negative label. Initial attempts with a stopped local server were excluded. No instruction change is justified by this run. Latest-head approval from another reviewer remains required.
fahreddinozcan
left a comment
There was a problem hiding this comment.
Reviewed benchmark commit 133c77d. GitHub CI passed. The shared runner scored the original 324 cases in all five configurations, including the six resumed follow-ups. One Claude Code case completed on retry.
On the held-out set, Claude Code went from 7/60 required lookups to 59/60 with zero extra calls in either run. Codex attempted 0/60 in both server-only arms and 60/60 with the exact #3669 rule in AGENTS.md, with zero extra calls on the held-out set. The explicit Context7 control resolved a library and fetched docs in both server-only Codex arms.
Codex with the rule made four extra calls on the 25 negative behavior cases and exceeded the call budget on 9/24 many-library cases. The PR description records the full matrix and reproduction steps.
…7-3596/direct-mcp-server-instructions # Conflicts: # packages/mcp/src/index.ts
… meta to constants
Updates the Context7 MCP server instructions to tell agents when to fetch documentation before answering.
_meta["anthropic/alwaysLoad"]onresolve-library-idandquery-docs, so Claude Code loads them up front instead of behind tool search. Other clients ignore the key.Closes CTX7-3596