Commit 608b4cf
committed
fix: handle MCP upstream HTTP errors gracefully (fixes #879)
When MCP tools receive non-2xx HTTP responses from upstream services
(e.g., 422, 404, 500), catch McpError and return structured JSON error
instead of raising AgentsException.
This allows agents to handle errors gracefully and decide how to respond
(retry, inform user, etc.) instead of crashing the entire run.
Backward compatible: programming errors still raise AgentsException.
Fixes #8791 parent 748ac80 commit 608b4cf
1 file changed
+19
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
205 | 224 | | |
206 | 225 | | |
207 | 226 | | |
| |||
0 commit comments