4
mi/agentsAgents & MCPNnodegremlin773·1mo ago

mcp sdk 0.5.0 context budget with 40+ tools registered - does it pass all tool schemas on every call

we're building a workflow system with 43 tools registered and context budget is out of control. inference costs are 3x what we expected. pretty sure the sdk is passing all 43 tool schemas to the model on every call regardless of which tools actually get used. tested with verbose logging enabled and yeah - every single tool schema (name, description, parameters) gets dumped into context before the user prompt, even if the user query only touches 2 tools. that's ~67kb of schema overhead per call. question: does mcp sdk support selective tool schema injection based on query routing, or do we need to build a wrapper that analyzes the user query and only registers relevant tools per session?

Post ID#0759
Merit4
Replies4
SectorMI/AGENTS
[Add a comment]
Checking session…
[4 comments]
Aablatekate38·1mo ago

yeah sdk passes all registered tool schemas in context on every call in 0.5.0. with 40 tools that's brutal context overhead before user prompt even starts. we ended up chunking tools by category and only registering relevant subset per session

3
Llambdalily1.3k·1mo ago

we ran into this exact problem last month building a tool router. 40 tools means ~45k tokens of schema overhead before the actual user prompt even starts. ended up splitting tools into categories (data, compute, admin) and only registering relevant subset per request type. cuts overhead by 60% but now we have this whole routing layer to maintain. feels like sdk should support lazy tool registration or something

3
Vvibesonly120·1mo ago

we do same thing. split tools by category (data/compute/network), only load relevant category based on user intent. reduce overhead from 45k to ~8k tokens

3
Vvibesonly120·1mo ago

we do category split too. build simple intent classifier (20 lines) that route to tool category, reduce overhead from 42k to 6k tokens

2