Agents and harnesses

JSON-RPC

Call Abazi's six agent tools with plain JSON-RPC 2.0 POST requests, without an MCP client or a session, from any language with an HTTP client.

View as .mdUpdated

Abazi's MCP endpoint is stateless streamable HTTP with JSON responses. That makes it a plain JSON-RPC 2.0 endpoint as well: one POST carries one request, one JSON body comes back, and no session id is kept between calls. An agent that has no MCP client calls the same six tools, with the same arguments and results, using only an HTTP library.

Endpoint and authentication

SettingValue
URLhttps://api.52-28-238-205.sslip.io/mcp
MethodPOST, one JSON-RPC 2.0 request per body
AuthorizationBearer agk_test_..., on every request
Content-Typeapplication/json
Acceptapplication/json, text/event-stream
SessionNone. No initialize handshake is required before a call, and no session header comes back.
Response200 with Content-Type: application/json

The Accept header must list both types, as the MCP transport requires. The server answers with plain JSON, never a stream. Keep the credential in a secret manager or in an environment variable such as ABAZI_AGENT_KEY; it identifies the agent and carries no spending power on its own. See Get an agent credential.

Call a tool

tools/call runs one tool. This request asks for the agent's spending status:

Terminal
curl -s https://api.52-28-238-205.sslip.io/mcp \
  -H "Authorization: Bearer $ABAZI_AGENT_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_spending_status","arguments":{}}}'
Response
{"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"{\n  \"available\": \"1200000\",\n  \"reserved\": \"100000\",\n  \"spent\": \"700000\",\n  \"limit\": \"2000000\",\n  \"asset\": \"USDC\",\n  \"hard_cap\": \"500000\",\n  \"auto_threshold\": \"100000\",\n  \"plan_hard_cap\": \"1500000\",\n  \"mandate_expires_at\": \"2026-11-28T23:59:59+00:00\",\n  \"mandate_status\": \"active\"\n}"}],"isError":false}}
capturedtools/call get_spending_status over plain JSON-RPC· the Abazi API · 2026-11-16· exit 200

The tool's result is a JSON string in result.content[0].text. Parse it a second time:

result.content[0].text, parsed
{
  "available": "1200000",
  "reserved": "100000",
  "spent": "700000",
  "limit": "2000000",
  "asset": "USDC",
  "hard_cap": "500000",
  "auto_threshold": "100000",
  "plan_hard_cap": "1500000",
  "mandate_expires_at": "2026-11-28T23:59:59+00:00",
  "mandate_status": "active"
}

Amounts are strings in base units of the asset. USDC has 6 decimals, so 1200000 is 1.20 USDC: this agent can still spend 1.20 of a 2.00 limit, with 0.70 spent and 0.10 held for a purchase in flight. A single purchase above 0.50 (hard_cap) is denied, and one above 0.10 (auto_threshold) waits for approval. Strings keep the arithmetic exact; convert with a decimal type, never a float.

The other methods

initialize

Optional. It returns the protocol version, the server's capabilities and its name. A script can skip it and call tools/call directly.

Terminal
curl -s https://api.52-28-238-205.sslip.io/mcp \
  -H "Authorization: Bearer $ABAZI_AGENT_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'
Response
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-03-26","capabilities":{"experimental":{},"prompts":{"listChanged":false},"resources":{"subscribe":false,"listChanged":false},"tools":{"listChanged":false}},"serverInfo":{"name":"gateway","version":"1.30.0"}}}
capturedinitialize over plain JSON-RPC· the Abazi API · 2026-11-16· exit 200

tools/list

Returns the six tools, each with a description and a JSON Schema for its arguments. Read it once to build your own function definitions for a non-MCP agent framework.

Request body
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
Response (shortened)
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "tools": [
      {
        "name": "search_catalog",
        "description": "Find paid services you can buy, with price, networks and merchant trust tier. ...",
        "inputSchema": { "type": "object", "required": ["query"], "properties": { "query": { "type": "string" }, "category": { "...": "..." }, "max_price_base_units": { "...": "..." }, "limit": { "type": "integer", "default": 10, "minimum": 1, "maximum": 20 } } }
      },
      { "name": "request_purchase", "description": "Buy one paid resource by service_id or url. ...", "inputSchema": { "...": "..." } }
    ]
  }
}

tools/call for search and purchase

The body has the same shape for every tool: params.name is the tool and params.arguments its input. Arguments and results are the ones documented in the MCP tool reference.

search_catalog
{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"search_catalog","arguments":{"query":"forecast","limit":5}}}
request_purchase
{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"request_purchase","arguments":{"service_id":"svc_...","task_id":"weekly-report-42","idempotency_key":"weekly-report-42-forecast","purpose":"Weather forecast for the logistics summary"}}}

The result of request_purchase is in result.content[0].text, with a status of paid, submitted, awaiting_approval or free. See search_catalog, request_purchase and get_spending_status for every field.

Errors

Two kinds of failure come back, and they look different.

JSON-RPC error object. A request the protocol cannot parse or route, such as malformed JSON or an unknown method, returns an error member with a numeric code and a message instead of a result. Fix the request; nothing was attempted.

Tool result with isError: true. A request that reached a tool and failed returns a normal result with isError set to true. The text block is JSON with a reason code and the next step:

result.content[0].text when isError is true
{ "error_code": "POLICY_DENIED", "reason_code": "BUDGET_EXCEEDED", "message": "...", "retryable": false, "next_action": "Call get_spending_status.", "intent_id": "pi_..." }

This covers policy denials, invalid arguments (VALIDATION_ERROR) and a missing, rotated or revoked credential (AGENT_CREDENTIAL_INVALID). The HTTP status is still 200, so check isError on every call. Act on retryable and next_action, and never retry a denial with a new idempotency key. Every reason code is in the reason code reference.

When to choose JSON-RPC

ChooseWhen
An MCP clientYour agent already runs in an MCP host. The client discovers the tools and handles the protocol for you.
JSON-RPCThere is no MCP client: a script, a cron job, an agent framework without MCP support, or any language with an HTTP client. You get the same six tools with the same semantics as MCP clients, without an MCP library.
RESTYou need more than the six agent tools. REST covers the full API surface, with resource URLs, Idempotency-Key headers and an OpenAPI contract for typed clients.

Next steps

On this page