Skip to main content
Glama

Plan a plain swap between two assets

plan_swap
Read-onlyIdempotent

Plans a swap of one asset for another from the wallet, through LoomDesk's own route over every Uniswap pool on the chain (one Universal Router transaction that checks the wallet received the least shown), and returns the unsigned transactions (approvals through Permit2 when paying with a token, then the swap). Use only when a wallet needs an asset on its own; to fund a position, prefer plan_build, which buys the sides it needs in the chain's own pools. Returns: transactions[] (to, data, value in wei, gas), check (simulated, ok, failedStep, reason, ethNeeded, ethHeld), sendWithin, ifItReverts, slippagePct, from and to with expected and atLeast amounts, hops, router. Behavior: read-only on our side; nothing is signed or sent. The plan is laid out from the chain at this block and simulated from the owner; send it within check.sendWithin, and plan again rather than resend one that reverted. Costs quota units (agent_quota). Errors: refused when no route exists for that amount.

Input Schema

NameRequiredDescriptionDefault
toYesThe asset wanted: ETH, USDG, a token symbol or a 0x address.
fromYesThe asset paid: ETH, USDG, a token symbol or a 0x address.
ownerYesThe wallet that signs and sends.
amountYesHow much of `from`, as a decimal string.
slippagePctNoRoom for the price to move, in percent. Left out: from the pool's recent moves, 1.5% at least.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedInput schema / properties / amount / description
      Previous value: -"how much of `from`, as a decimal string"New value: +"How much of `from`, as a decimal string."
    • changedInput schema / properties / from / description
      Previous value: -"ETH, USDG, a token symbol or address"New value: +"The asset paid: ETH, USDG, a token symbol or a 0x address."
    • addedInput schema / properties / owner / description
      Added value: +"The wallet that signs and sends."
    • addedInput schema / properties / slippagePct / description
      Added value: +"Room for the price to move, in percent. Left out: from the pool's recent moves, 1.5% at least."
    • changedInput schema / properties / to / description
      Previous value: -"ETH, USDG, a token symbol or address"New value: +"The asset wanted: ETH, USDG, a token symbol or a 0x address."
  2. Changed10 schema fields changed
    • removedInput schema / properties / from / anyOf
      Removed value: -[
      -  {
      -    "enum": [
      -      "ETH",
      -      "USDG"
      -    ],
      -    "type": "string"
      -  },
      -  {
      -    "pattern": "^0x[0-9a-fA-F]{40}$",
      -    "type": "string"
      -  }
      -]
    • addedInput schema / properties / from / description
      Added value: +"ETH, USDG, a token symbol or address"
    • addedInput schema / properties / from / maxLength
      Added value: +64
    • addedInput schema / properties / from / minLength
      Added value: +1
    • addedInput schema / properties / from / type
      Added value: +"string"
    • removedInput schema / properties / to / anyOf
      Removed value: -[
      -  {
      -    "enum": [
      -      "ETH",
      -      "USDG"
      -    ],
      -    "type": "string"
      -  },
      -  {
      -    "pattern": "^0x[0-9a-fA-F]{40}$",
      -    "type": "string"
      -  }
      -]
    • addedInput schema / properties / to / description
      Added value: +"ETH, USDG, a token symbol or address"
    • addedInput schema / properties / to / maxLength
      Added value: +64
    • addedInput schema / properties / to / minLength
      Added value: +1
    • addedInput schema / properties / to / type
      Added value: +"string"
  3. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare read-only and non-destructive, but the description adds substantial behavioral detail beyond them: the route and Universal Router mechanics, Permit2 approvals, that output includes unsigned transactions, a simulated check with ok/failedStep/reason, slippage handling, quota cost, and the specific error when no route exists. This is rich transparency well beyond the structured hints.

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?

A single dense paragraph that front-loads what the tool does, then covers alternatives, return shape, behavior, and errors. It is efficient but slightly overstuffed, packing return-field enumeration and several caveats into one breath; still, every sentence carries useful information.

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 a planning tool with no output schema, the description fully specifies the return payload (transactions, check with simulated/ok/failedStep/reason/ethNeeded/ethHeld, sendWithin, ifItReverts, slippagePct, from/to with expected and atLeast, hops, router), the read-only side effects, quota cost, and the refusal error condition. An agent has everything needed to call and interpret it correctly.

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

Parameters3/5

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

Schema coverage is 100%, so every parameter is already documented in the schema; the description does not add format or semantic detail beyond what the schema provides (it mentions from/to/amount/owner only implicitly through the return-value sentence). Baseline 3 is appropriate when the schema does the heavy lifting.

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 states a specific verb (Plans) and resource (a swap of one asset for another) and scopes it to LoomDesk's own route over Uniswap pools, producing unsigned transactions. It explicitly distinguishes itself from plan_build, naming the sibling and when to prefer it.

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?

It gives an explicit when-to-use rule ('Use only when a wallet needs an asset on its own') and a direct alternative ('to fund a position, prefer plan_build'), plus a send-within constraint and a rule to re-plan rather than resend reverted plans. This is as clear as it gets.

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