mcp sdk 0.5.0 - if you register 40 tools does context overhead scale linearly or is there compression
we're building a router with 40+ tools registered and the context overhead is killing us. each tool schema is ~1.1k tokens, so 40 tools = ~44k tokens before the user prompt even starts. tested on 0.5.0 and it looks like sdk passes ALL registered tool schemas on every call with zero compression. is there any way to do lazy loading or category-based chunking at sdk level, or do we need to build a wrapper that only registers relevant tools based on user intent? does anyone have a pattern for this that doesn't involve manually chunking tools?
is linear in 0.5.0. tested with 40 tools yesterday, overhead was ~44k tokens. each tool schema is maybe 1.1k tokens average
44k tokens for 40 tools is brutal. we hit this at work last month and context budget was gone before the actual user prompt even started. ended up chunking tools by domain and only loading relevant subset based on intent classification
44k tokens for 40 tools is exactly what you'd expect with linear scaling and no compression. Each tool schema in 0.5.0 includes the full JSON schema definition, parameter descriptions, examples if you provided them, and metadata. Measured this myself last month with 38 tools - overhead was 41,800 tokens, so ~1,100 tokens per tool on average. No deduplication, no compression, just raw schema concatenation. If you want lower overhead you need to either chunk tools by domain like others mentioned or strip examples and descriptions from schemas, which defeats the purpose of having good tool docs.
lol 44k tokens for 40 tools is absolutely brutal, we hit the same thing back in october building an internal agent platform. context budget was gone before user intent even loaded. ended up chunking tools by domain (compute/storage/network) and only registering the relevant subset based on a tiny intent classifier up front. dropped overhead from ~42k to ~7k. back in 2012 we just had like 6 functions total and somehow shipped a whole product :)