A JSON-RPC error, or a tool result the server marked isError: MCP reports a failed tool call as a normal result, so checking only "error" counts every failure as served (a lab measuring nothing looked healthy).
(reply)
| 33 | |
| 34 | |
| 35 | def tool_failed(reply): |
| 36 | """A JSON-RPC error, or a tool result the server marked isError: MCP reports |
| 37 | a failed tool call as a normal result, so checking only "error" counts every |
| 38 | failure as served (a lab measuring nothing looked healthy).""" |
| 39 | if "error" in reply: |
| 40 | return True |
| 41 | result = reply.get("result") |
| 42 | return isinstance(result, dict) and bool(result.get("isError")) |
| 43 | |
| 44 | |
| 45 | def main(): |