Give a language model a swap tool, not your private key

By Cleave Protocol

MCP hands a model tools as data: a name, a description and a JSON Schema. How tools/list and tools/call work, and why a swap plan stays unsigned.

Watch on YouTube

One way to let a language model trade is to hand it a private key. A model with a key can spend everything the key controls, on any prompt that convinces it to. A swap tool does not need the key at all. The Model Context Protocol, MCP, gives a cleaner split: the model asks, a server plans, and the wallet signs.

What MCP is

MCP lets a server offer tools that a language model can invoke. The host application runs an MCP client that exchanges JSON-RPC 2.0 messages with the tool server. The model never talks to the server directly. The app around the model does.

A tool is data

Each tool has a name and an input schema. It can also include a description to help the model choose it. The schema must be a valid JSON Schema object. A swap-planning tool, abridged and simplified, looks like this:

{
  "name": "cleave_plan_swap",
  "description": "Plans a swap and returns unsigned calls in signing order",
  "inputSchema": {
    "type": "object",
    "properties": {
      "fromChainId": { "type": "integer" },
      "sellToken": { "type": "string" },
      "buyToken": { "type": "string" },
      "amount": { "type": "string" },
      "wallet": { "type": "string" }
    },
    "required": ["fromChainId", "sellToken", "buyToken", "amount", "wallet"]
  }
}

The model reads the description to decide when the tool fits, and the schema to decide what arguments to send. Nothing in it is code the model runs. It only describes what the server accepts.

List, pick, call

Cleave Protocol's agent registration file advertises MCP 2025-11-25 for its server. After the client sends initialize, receives the server's capabilities and sends notifications/initialized, it can discover and call tools as follows:

  1. The app sends tools/list. The server returns its tools.
  2. The app shows them to the model. The model picks one and fills in its arguments.
  3. The app sends tools/call with the tool name and those arguments.
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "cleave_plan_swap",
    "arguments": {
      "fromChainId": 8453,
      "sellToken": "USDC",
      "buyToken": "WETH",
      "amount": "25",
      "wallet": "0x00000000000000000000000000000000000A11cE"
    }
  }
}

This example uses MCP 2025-11-25, where params._meta is optional for tools/call. Clients using 2026-07-28 must include that revision's required request metadata.

The result comes back to the app, which passes it to the model. An error the model can act on, such as a bad argument, comes back as a result marked isError: true, so the model can correct itself and try again.

A human can say no

The MCP spec says there should always be a human in the loop with the ability to deny tool invocations. It asks applications to show which tools are exposed, to mark when a tool runs, and to ask the user to confirm operations. It also asks clients to validate tool results before passing them to the model. For a tool that touches money, those are the controls that matter most.

How Cleave Protocol's server fits

Cleave Protocol runs a remote MCP server with four tools: cleave_plan_swap, cleave_track_swap, cleave_find_token and cleave_get_gas. No API key is needed.

In the official MCP registry it is listed as fi.cleave/swap. The prefix is the domain cleave.fi written in reverse. The registry grants a domain-based name like that only after the publisher proves control of the domain, through a DNS record or a file served from the domain. A server that claims a reversed domain it does not control cannot publish under it.

The plan tool moves no funds. It returns unsigned calls, each with a chain id, a from address, a target, call data and a value, in the order they should be signed. The wallet that holds the key signs them, or does not. The connection URL can also pin one wallet, so a plan for any other wallet is refused.

The model asks. Cleave plans. Your wallet signs.

The connection details, tool inputs and limits are on the MCP server docs page.