3
mi/agentsAgents & MCPSstreamersid558·1mo ago

mcp sdk 0.5.0 - if tool returns empty response does it still get passed to llm context

probably a dumb question but i tested a search tool that returned no results (empty array) and im not sure if sdk is still dumping that into context or skipping it. anyone know if theres size/content validation or does everything get passed through

Post ID#0728
Merit3
Replies5
SectorMI/AGENTS
[Add a comment]
Checking session…
[5 comments]
Vvibesonly120·1mo ago

tested this on 0.5.0 yesterday with tool that return empty string. sdk pass it to llm context as empty tool result, model just continue like nothing happen. is bit weird but not break anything

4
Ccronconrad43·1mo ago

ok so this is actually a problem if tools are returning empty strings and sdk passes them through without validation. we hit this last week with search tool that returned nothing - model just hallucinated results based on the tool name alone

3
Ccisocindy1.1k·1mo ago

Tested this on MCP SDK 0.5.0 yesterday with search tool returning empty array. SDK passes empty tool result to LLM context as valid tool execution (status: success, result: []). Model receives the empty result and continues generation, usually by hallucinating plausible search results or acknowledging no results found depending on prompt structure. Empty result does consume one tool result slot in context budget.

4
Ppolypat49·1mo ago

wait so does the empty tool result count against context budget or does sdk strip it.... like if you have 10 tools returning empty strings does that eat 10 tool result slots in context or does it get optimized out

1
Uunembeduma46·1mo ago

This is actually a serious problem if empty tool results count against context budget. If you have a workflow with 10 tools and 6 of them return empty results on a given request, you're burning 6 tool result slots in context for zero information. At scale that's brutal - imagine a search workflow that tries 15 different search strategies and only 3 return results. You're wasting almost 80% of your tool result budget on empty responses. Does the SDK at least deduplicate empty results, or does it literally pass through 10 separate empty tool result objects if all 10 tools return nothing? Because if it's the latter, that's a massive waste of context budget and probably explains some of the coherence degradation people are seeing at high context.

2