fix: inject deferred MCP tools into system prompt and lift selectSearch cap - #343
Open
OliverZou wants to merge 1 commit into
Open
fix: inject deferred MCP tools into system prompt and lift selectSearch cap#343OliverZou wants to merge 1 commit into
OliverZou wants to merge 1 commit into
Conversation
…ch cap Two issues left the agent blind to available MCP tools: 1. The system prompt had no visibility into which MCP tools exist. The <available-deferred-tools> block was only surfaced inside tool_search responses, so the agent could not discover MCP tools without first knowing to call tool_search — a discoverability deadlock. 2. tool_search capped exact-name (select:) queries at maxSearchResults=5, silently dropping the rest even when the user explicitly named them. Fixes: - Inject <available-deferred-tools> into every turn via a dynamic system block so the agent always knows what MCP tools are available. - Cap the block at 4000 characters (newline-boundary truncation) with an omission notice so many tools don't blow up the prompt. - Remove the maxSearchResults cap from selectSearch so select: queries return every requested tool, not just the first five. - Show all tool names (not just the first five) in tool_search no-match hints, aligning with the new system-prompt visibility. - Add tests for the new render path, selectSearch cap removal, truncation behavior, and updated hint format.
OliverZou
force-pushed
the
fix/mcp-tools-lost
branch
from
July 18, 2026 17:38
70956fc to
36054dc
Compare
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
Two issues left the agent blind to available MCP tools:
The system prompt had no visibility into which MCP tools exist. The
<available-deferred-tools>block was only surfaced insidetool_searchresponses, so the agent could not discover MCP tools without first knowing to calltool_search— a discoverability deadlock.tool_searchcapped exact-name (select:) queries at maxSearchResults=5, silently dropping the rest even when the user explicitly named them.Fixes:
<available-deferred-tools>into every turn via a dynamic system block so the agent always knows what MCP tools are available.Validation
User-visible impact
<available-deferred-tools>block listing all connected MCP tools.Breaking changes
None.
Notes