Skip to main content
Glama

Cleave for Agents: token swaps, cross-chain swaps and gas top-ups

Plan a swap, bridge or gas top-up

cleave_plan_swap
Read-onlyIdempotent

Plans a token swap on one chain, a cross-chain swap or bridge, or a native-gas top-up on Ethereum, Arbitrum, Base, BNB Chain, Polygon or Optimism, and returns unsigned transactions for the given wallet to sign. It fits when the user wants to exchange tokens, move them between these chains, or get ETH, BNB or POL for gas. It sends nothing and moves no funds. The answer leads with blocking notices and warnings, then gives the route's outcome kind (an exact amount or one that can vary; with a swap on arrival, the token or, possibly, a named fallback; where a transfer can go unfilled, a possible refund of the bridged token on the source chain, which can take hours or longer and may not happen), every third-party cost except network gas, the expected time, validUntil and the calls in signing order. The main call can carry gas, the recommended gas limit: use it as the transaction's gas limit, and without it estimate with a priority fee above zero. A blocking notice returns no calls; a warning, or a recipient other than the wallet, sets requiresConfirmation, and the connection's settings can turn either into a refusal. Calls sent after validUntil are stale: they can revert or, on some routes, end in a refund later, or not at all. Amounts are decimal strings in token units; tokens are listed symbols or contract addresses; the recipient defaults to the wallet, which fits when the person's own wallet pays; if your wallet pays for a person, ask them for the recipient, and use your own only for your own tokens. Limits set in the connection (a pinned wallet, a per-plan USD cap, listed tokens only) bound every argument. For an ambiguous symbol, cleave_find_token lists the candidates; after sending, cleave_track_swap reports progress. A wallet with no gas can order it with cleave_get_gas.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "fromChainId": "<fromChainId>",
      "sellToken": "<sellToken>",
      "buyToken": "<buyToken>",
      "amount": "<amount>",
      "wallet": "<wallet>"
    },
    "name": "cleave_plan_swap"
  }
}

Input Schema

NameRequiredDescriptionDefault
amountYesA decimal amount in token units
walletYesThe wallet that sells the token and signs the returned calls
buyTokenYesA listed symbol or a contract address
recipientNoThe address that receives the bought token; the wallet when omitted. If your wallet pays for a person, ask them for it; use your own only for your own tokens
sellTokenYesA listed symbol or a contract address
toChainIdNoThe chain of the token to buy; fromChainId when omitted
fromChainIdYesThe chain of the token to sell
maxSlippageBpsNoThe maximum slippage in basis points, from 0 to 5000, and at least 1 for a cross-chain plan that swaps on both chains; 50 when omitted

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / recipient / description
      Previous value: -"The address that receives the bought token; the wallet when omitted"New value: +"The address that receives the bought token; the wallet when omitted. If your wallet pays for a person, ask them for it; use your own only for your own tokens"
  2. Changed5 schema fields changed
    • addedInput schema / properties / fromChainId / description
      Added value: +"The chain of the token to sell"
    • addedInput schema / properties / maxSlippageBps / description
      Added value: +"The maximum slippage in basis points, from 0 to 5000, and at least 1 for a cross-chain plan that swaps on both chains; 50 when omitted"
    • addedInput schema / properties / recipient / description
      Added value: +"The address that receives the bought token; the wallet when omitted"
    • addedInput schema / properties / toChainId / description
      Added value: +"The chain of the token to buy; fromChainId when omitted"
    • addedInput schema / properties / wallet / description
      Added value: +"The wallet that sells the token and signs the returned calls"
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/not-destructive/state-free, and the description reinforces this with "It sends nothing and moves no funds." Beyond the annotations it discloses confirmation semantics (blocking notice returns no calls, warnings or a third-party recipient set requiresConfirmation, connection settings can escalate to refusal), staleness behavior after validUntil, gas-limit usage, and refund risk on unfilled transfers.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and the safety statement are front-loaded, but the middle is a single sprawling sentence about outcome kinds with deeply nested parentheses that is hard to parse. The recipient-default rule is stated twice, once in the description and again in the schema, which is wasted space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 8-parameter planning tool with no output schema, the description covers the returned payload structure (blocking notices, warnings, outcome kind including variable amounts and refunds, third-party costs excluding gas, expected time, validUntil, calls in signing order) and the confirmation flow. Nothing an agent needs to call or interpret this tool correctly is absent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; the description still adds meaning by explaining that amounts are decimal strings in token units, tokens are listed symbols or contract addresses, and the recipient defaults to the wallet with an explicit rule for when an agent's wallet pays for someone else. It does not add guidance on maxSlippageBps or the chain-id enum beyond what the schema states.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and enumerates the exact resources covered: a token swap on one chain, a cross-chain swap or bridge, or a native-gas top-up, plus the supported chains. It also states the artifact produced (unsigned transactions for a wallet to sign), which separates it cleanly from cleave_find_token, cleave_track_swap and cleave_get_gas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit fit condition ("It fits when the user wants to exchange tokens, move them between these chains, or get ETH, BNB or POL for gas") and routes to each sibling by condition: ambiguous symbol to cleave_find_token, post-send progress to cleave_track_swap, gas-less wallet to cleave_get_gas. It also states limits imposed by connection settings that bound every argument.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.