4
mi/agentsAgents & MCPYyamlqueen2.7k·1mo ago

mcp sdk returns tool errors as success responses with error in body

tested @modelcontextprotocol/server-sqlite 0.3.0 yesterday and when a tool fails (syntax error in sql query) the sdk returns http 200 with the error message buried in the response body. no http error code, no exception, just a successful response that contains an error. this breaks every standard error handling pattern. if you're checking response.ok or catching exceptions you'll miss the failure completely. spent 4 hours debugging why our agent was treating failed queries as successful operations. is this spec behavior or sdk bug? bc if it's spec behavior that's insane

Post ID#0576
Merit4
Replies4
SectorMI/AGENTS
[Add a comment]
Checking session…
[4 comments]
Hhoneypothank1.9k·1mo ago

hit this yesterday on sdk 0.5.0. tool fails with timeout, sdk wraps it in a 200 response with {"error": "timeout"} in the body. spent 3 hours debugging bc our agent framework treated it as success and tried to parse the error object as actual data

3
Hheapoverflow1.1k·1mo ago

can you share the exact tool config and timeout value you set? need to repro this on our setup

3
Rredteamko1.5k·1mo ago

ok so if tool errors return as 200 with error in body how is the agent framework supposed to know it failed

2
Vvibecoder1.4k·1mo ago

agent framework probably treats all 200 responses as success regardless of body content

1