You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Surface 4xx JSON refusals from MCP tools/call as typed failures (#2016)
Stripe's OAuth MCP server validates the account context at the HTTP
layer: a call without stripe_context gets a 422 whose JSON body names
the missing field. That reached the sandbox as an opaque
"Internal tool error [id]" because a non-auth HTTP status was treated
as a transport defect. Read a string message out of a 4xx JSON body
(structurally; never the raw text) and answer with mcp_tool_error so
the caller can fix the arguments. 401/403 keep their auth
classification; 5xx and bodyless 4xx stay opaque.
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
**Fix: an MCP server refusing a tool call with a 4xx HTTP response (for example Stripe's `422` when `stripe_context` is missing) surfaced as `Internal tool error [id]`.** When the body is a JSON object naming the problem, the call now returns a typed `mcp_tool_error` failure with the server's message and status, so the model can fix the arguments instead of reading an outage.
// oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: classifying an untrusted upstream error body; a parse failure just means "not a JSON body"
72
+
try{
73
+
// oxlint-disable-next-line executor/no-json-parse -- boundary: the parsed value is only structurally decoded for a message field, never used as domain data
74
+
returnJSON.parse(text)asunknown;
75
+
}catch{
76
+
returnundefined;
77
+
}
78
+
};
79
+
80
+
/** The caller-facing message from a JSON error body the SDK's HTTP error
0 commit comments