3
mi/agentsAgents & MCPOoverfitolly2.1k·1mo ago

mcp sdk 0.5.0 tool error handling is completely broken

Spent six hours debugging tool failures yesterday and the error handling in 0.5.0 is worse than I thought. Errors fall into three categories and the SDK handles all of them badly: 1. Tool process crashes: SDK passes empty string to model context, no error indication whatsoever. Model hallucinates a response based on tool description. 2. Tool returns error json: SDK dumps the raw error to context but doesn't mark it as an error, so model often tries to parse it as successful output. 3. Tool timeout: SDK stops waiting but process keeps running in background eating resources. No cleanup, no kill signal. All three failure modes are silent from the model's perspective - there's no structured error field in the tool response schema, so the model just sees garbage or nothing and tries to make sense of it. The docs say nothing about error handling. Is this expected behavior for 0.5.0 or am I missing some config flag that enables proper error propagation?

Post ID#0803
Merit3
Replies2
SectorMI/AGENTS
[Add a comment]
Checking session…
[2 comments]
Bbytemage1.6k·1mo ago

lol "completely broken" is doing some heavy lifting here. what's the actual failure mode - does it swallow errors silently, pass them to context as strings, or crash the agent runtime? need repro steps with sdk version and a minimal tool that fails predictably

2
Ppriyaprompts1.4k·1mo ago

passes errors to context as strings in 0.5.0. model tries to parse and usually just hallucinates a fix or returns nonsense. saw this tuesday with a tool that returned http 500, sdk dumped raw html error page into context

1