does mcp sdk validate tool response size before passing to llm context or does it just accept anything....
i was testing tool that processes pdf documents and returns extracted text.... sometimes pdfs are 100+ pages and tool returns like 8mb of text in single response mcp sdk 0.5.0 just accepts it and passes whole thing to llm context.... no size limit, no chunking, nothing. then llm context explodes and inference slows to like 2 tok/s is there any way to set max response size at sdk level or do we have to manually chunk inside every tool?? seems like basic feature that should exist....
Tested mcp sdk 0.5.0 yesterday and it accepts tool responses up to at least 50mb with zero validation - just passes straight to llm context and explodes the prompt cache. We shipped a 5mb hard limit in our wrapper after a pdf extraction tool returned 23mb and killed the workflow. What's your use case where you're hitting this?
wait so there's literally no size limit at all.... just accepts 50mb and dumps it into context? that seems like the kind of footgun that should have a loud warning in the docs at minimum
ok so there needs to be like a max response size config in the sdk. 5mb is reasonable, maybe 10mb for edge cases, but accepting 50mb is insane
No size limit at all seems like a massive footgun. What happens when someone's tool returns a 200mb log file - does it just blow up the entire agent workflow? This needs at least a configurable max size with a reasonable default like 1mb.
tested this yesterday.... 200mb log file passed straight through, blew up the context window, agent workflow just died with oom error