Envelope shape
When a tool fails, the result it returns to the client has anerror field
matching the JSON-RPC 2.0 error-object shape:
data payload is an RFC 9457 Problem Details
document — the same structure the REST API returns under
Content-Type: application/problem+json. Agents that already understand
Closient’s REST error shape do not need a second mapping.
Successful tool calls do not include an error key — the tool’s normal
payload is returned directly.
Code table
JSON-RPC error codes are stable and grouped by failure class:
Adding new codes within these ranges is non-breaking. Renumbering existing
codes is a breaking change.