Repository navigation
feat(harness): list deferred MCP servers in an mcpservers prompt section - #117
Merged
Merged
Conversation
Servers whose tools are not declared to the model are listed in a new harness-rendered `mcpservers` section, each with how its tools are reached (`toolsearch`) and a one-line summary: the configured description, or the first line of the server's instructions once it connected. The section is worked out after the startup wait for servers with direct tools and held for the rest of a run, so a server that connects mid-run shows at the next prompt, as a system entry carrying only that section. It is left out while toolsearch is not declared, and a server disconnected on request is dropped from it. Servers whose tools are all codemode are not listed, since nothing reaches them yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
MCP servers whose tools are not declared to the model are now listed in a harness-rendered
mcpserverssystem-prompt section, so the model knows they exist and how to reach them.- mcp__<server> (toolsearch): <summary>. The summary is the first line of the configureddescription, or of the server'sinstructionsonce it connected. Summaries are capped at 250 characters and the section at 4096; servers that don't fit are counted in a closing line.directtools, then held for the rest of the run. A server that connects mid-run shows at the next prompt.mcpservers, through the existing section-diff machinery, so the cached prefix survives.toolsearchis not declared (it turns itself on when a turn has deferred tools, so this only happens when it is turned off), and for a server disconnected on request.codemodeare not listed, since nothing reaches them yet. A server with bothcodemodeanddeferredtools is listed undertoolsearch.mcpserversis a reserved section name in@codeworksh/plugin, liketoolsandcwd.toolsearchtool name moved totool/search.ts, so the MCP domain and the prompt renderer don't depend on the built-in plugin.Tests
test/mcp.section.test.ts(E2E, scripted model, real stdio server): a server is listed without a summary while connecting, connects mid-run without changing that run, gets its summary at the next prompt as a section-only entry, and is removed after a disconnect. Artifact:mcp.section.json.test/mcp.section.live.test.ts(live, openai-codex gpt-6-luna): a deferred server is listed with its description, then after the description is dropped the next request carries onlymcpserverswith the summary from the instructions, and the model answers from it. Artifact:mcp.section.live.openai-codex.json.mcpserversfor threads with deferred servers.vp check, typecheck (harness, plugin) and the full harness suite pass.🤖 Generated with Claude Code