Skip to main content
Glama

evm_swap

Destructive

Execute a spot swap on an EVM chain (non-custodial, two-phase, OPT-IN).

chain must be named explicitly -- nothing routes to an EVM chain by default and a Solana route never fails over onto one. Base only today.

Without signed_transaction: returns an UNSIGNED EIP-1559 transaction under 'evm_transaction' (Crank fills nonce, gas and 1559 fees, and re-estimates gas against current state). Sign it with YOUR wallet for taker -- Crank never signs and never holds a key. The first time a given ERC-20 is sold the response is phase='approval_required' with an 'approval_transaction' for the EXACT sell amount (never an unlimited allowance); sign that, wait for its receipt, then call again.

With signed_transaction: broadcasts the signed RLP and returns tx_hash plus a 'verification' block -- receipt status (a MINED transaction is NOT necessarily a SUCCESSFUL one), the fill parsed from the ERC-20 Transfer log, and a balance cross-check. Gate follow-on decisions on verification.status == 'success'.

Value-bearing: the SAME technology service fee schedule as every other Crank venue, at the same rate -- there is no per-chain fee differentiation. Paper trading mode returns a real 0x quote and builds nothing signable.

idempotency_key (optional): reuse the SAME key across the SWAP build call and its signed_transaction completion retry. Do NOT carry a key across the approval_required response into the swap build that follows it -- those are two different calls, and the approval leg is not deduplicated at all (it builds nothing that could be duplicated: an ERC-20 approve SETS an allowance rather than adding to one, so re-issuing it is a no-op).

replace_nonce / replace_max_fee_per_gas / replace_max_priority_fee_per_gas (optional, all three together, BUILD leg only): rebuild this swap at the nonce of a transaction you already broadcast that is stuck unmined, with both EIP-1559 fee fields bumped past the ones it carries so a node accepts it as a replacement instead of rejecting it as underpriced. Pass the stuck transaction's own nonce and fee pair (decimal or 0x-hex). Sign and broadcast the result as normal -- whichever of the two transactions lands, only one can, because they share a nonce.

A replacement build IS billed the technology service fee, as its own action. It is a fresh 0x quote, a fresh gas estimate and a fresh transaction built against current state, and the fee is not suppressible on a leg the caller triggers by passing three parameters -- that would be a free-swap switch. Budget for it before replacing: a stuck swap that you replace costs two fees, not one.

Use a FRESH idempotency_key for a replacement call (or omit it). The replace_* values are part of the idempotency identity, so carrying the stuck build's key forward raises IDEMPOTENCY_CONFLICT (non-retryable) -- same key, different arguments. That refusal is deliberate: the alternative would be replaying the cached original build back at you, old nonce and old fees, which is silently NOT the replacement you asked for. Retries of the SAME replacement, under its own fresh key, deduplicate normally.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNobase
takerYes
verifyNo
buy_tokenYes
caller_idNo
sell_tokenYes
sell_amountYes
pay_in_crankNo
slippage_bpsNo
replace_nonceNo
payment_headerNo
idempotency_keyNo
pre_buy_balanceNo
signed_transactionNo
expected_buy_amountNo
replace_max_fee_per_gasNo
replace_max_priority_fee_per_gasNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

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

The description goes far beyond the annotations, explaining the two-phase flow, non-custodial signing, exact-sell-amount approvals, mined-vs-successful verification, fee billing, idempotency conflicts, and replacement semantics. This gives an agent an accurate mental model of side effects and failure modes. The description is consistent with readOnlyHint=false and destructiveHint=true, so there is no annotation contradiction.

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

Conciseness4/5

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

The description is long but front-loaded with the core purpose and structured into logical paragraphs for build, broadcast, fees, idempotency, and replacement. Most sentences earn their place because they address non-obvious behavioral traps. It is slightly verbose in the replacement section, but given the complexity of the tool, the detail is largely justified.

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

Completeness4/5

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

For a 17-parameter, two-phase, non-custodial swap tool with destructive and non-idempotent behavior, the description is unusually complete. It covers the full lifecycle including approval, verification, fees, and replacement edge cases. The remaining gaps are in optional parameter semantics and explicit sibling routing, but an agent can likely invoke the core functionality correctly from this description alone.

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?

With 0% schema description coverage, the description compensates for the most complex and non-obvious parameters: chain, signed_transaction, idempotency_key, and the replace_* trio. Core required parameters like sell_token, buy_token, sell_amount, and taker are inferable from names and context. However, several optional parameters such as slippage_bps, pay_in_crank, pre_buy_balance, expected_buy_amount, caller_id, and payment_header remain largely unexplained, which prevents a higher score.

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?

The description opens with a specific verb and resource: 'Execute a spot swap on an EVM chain', and immediately adds scope constraints (non-custodial, two-phase, opt-in, Base-only). It distinguishes itself from quote-only siblings by focusing on execution, and clarifies it is not a default fallback for Solana routes. This is a sharply differentiated purpose statement.

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

Usage Guidelines4/5

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

The description gives clear operational usage: when to call without signed_transaction to build, when to call with signed_transaction to broadcast, how to handle approval_required, and how replacement builds work. It does not explicitly name sibling alternatives like evm_swap_quote or jupiter_swap, but it does establish the preconditions and phases for using this tool correctly.

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.

Resources