Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

JSON-RPC

POST /jsonrpc is a generic JSON-RPC 2.0 endpoint for gateways that route, validate, rate limit or log JSON-RPC traffic (the transport style of MCP and A2A) without the protocol-specific semantics.

MethodParamsResult
echoanythingthe params
add[n, ...] or {"a", "b"}the sum
subtract[minuend, subtrahend] or {"minuend", "subtrahend"}the difference
sleep[ms] or {"ms"}waits (capped by the instance delay limit: 30 s, 10 s in public mode), then answers
error[code, message?, data?] or {"code", "message", "data"}replies with that error object

Behaviour per the specification:

  • Batches (arrays) run concurrently; at most 100 entries (20 in public mode).
  • Notifications (no id) get no reply; a single notification, or a batch of only notifications, answers 204 No Content.
  • Errors: -32700 parse error (with id: null), -32600 invalid request, -32601 method not found (the data lists the available methods), -32602 invalid params, -32603 internal error.
  • The HTTP status is 200 for every reply, as JSON-RPC over HTTP expects.
POST {{base_url}}/jsonrpc
Content-Type: application/json
{"jsonrpc": "2.0", "method": "subtract", "params": {"minuend": 42, "subtrahend": 23}, "id": 1}
HTTP 200
[Asserts]
jsonpath "$.result" == 19
jsonpath "$.id" == 1
POST {{base_url}}/jsonrpc
Content-Type: application/json
[
  {"jsonrpc": "2.0", "method": "add", "params": [1, 2, 4], "id": "1"},
  {"jsonrpc": "2.0", "method": "echo", "params": {"hello": "world"}},
  {"jsonrpc": "2.0", "method": "echo", "params": ["x"], "id": "2"},
  {"jsonrpc": "2.0", "method": "nope", "id": "3"}
]
HTTP 200
[Asserts]
jsonpath "$" count == 3
jsonpath "$[0].result" == 7
jsonpath "$[1].result[0]" == "x"
jsonpath "$[2].error.code" == -32601
POST {{base_url}}/jsonrpc
Content-Type: application/json
{"jsonrpc": "2.0", "method": "echo", "params": ["fire and forget"]}
HTTP 204
POST {{base_url}}/jsonrpc
Content-Type: application/json
{"jsonrpc": "2.0", "method": "error", "params": {"code": -32001, "message": "Rate limited", "data": {"retry_after": 1}}, "id": 7}
HTTP 200
[Asserts]
jsonpath "$.error.code" == -32001
jsonpath "$.error.message" == "Rate limited"
jsonpath "$.error.data.retry_after" == 1
POST {{base_url}}/jsonrpc
Content-Type: application/json
{"jsonrpc": "2.0", "method": "sleep", "params": {"ms": 200}, "id": "slow"}
HTTP 200
[Asserts]
duration >= 200
POST {{base_url}}/jsonrpc
Content-Type: application/json

{"jsonrpc": "2.0", "method":

HTTP 200
[Asserts]
jsonpath "$.error.code" == -32700
jsonpath "$.id" == null