Repository navigation
Conversation
nc-review: needs work — 2 blocking, 1 important, 3 nits@rishu685 — there is a blocking item below. The PR implements on-demand MCP tool discovery via a new MCPToolCatalog, a load_tool_schema built-in tool, prompt injection of the catalog, and direct-execution hydration fallback. The mechanism is sound and the new tests exercise the auto-threshold path meaningfully. However, the JSON config schema is not regenerated after adding 🔴 blocking ·
🔴 blocking ·
🟠 important · The added discovery test passes no ⚪ nit · The ⚪ nit · Five ⚪ nit ·
🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
…fig to callers, and add tests
|
Made the required changes as per the feedback |
Implements On-demand MCP Tool Discovery to prevent massive MCP JSON schemas from consuming local model context windows and degrading reasoning capabilities when multiple MCP servers or tool-heavy servers are connected (#1571).
What Changed
Lightweight MCP Tool Catalog (
source/mcp/tool-catalog.ts):name,serverName, truncateddescription).tune.mcpDiscovery: 'auto' | 'always' | 'disabled').Built-in Discovery Tool (
source/tools/mcp/load-tool-schema.tsx):load_tool_schematool accepting an array of tool names.readOnly: truewith automatic approval (approval: () => false) so it works across all development modes (including plan mode).Tool Manager Integration (
source/tools/tool-manager.ts):getFilteredTools,getToolHandler, andgetToolEntry.load_tool_schemafirst,ToolManagerautomatically hydrates it on the fly and proceeds without failing the turn.System Prompt Integration (
source/utils/prompt-builder.ts):load_tool_schemawhen needed.Configuration & Types (
source/types/config.ts,source/types/mcp.ts):tune.mcpDiscoverysetting (auto,always,disabled).MCPToolCatalogEntryand helper methods onMCPClient.Changeset:
.changeset/on-demand-mcp-discovery.md.Verification
ava) fortool-catalog.spec.ts,load-tool-schema.spec.tsx, andtool-manager.spec.ts.tsc --noEmit).biome check).knip).semgrep scan --config auto --errorwith 0 findings).Closes #1571