Skip to main content
Glama

Plan a limit buy or a limit sell

plan_limit_order
Read-onlyIdempotent

Plans an order at a price and returns the unsigned transactions. A limit sell holds the token in rungs over the price and sells as the price rises through them; a limit buy holds the quote under the price and buys as it falls. Use when the wallet wants to buy or sell at a price, not now; for a band around the price use plan_ladder or plan_build. Nothing is swapped at placing; the order earns the pool's fee while it fills; a part fill is not final (the rungs trade back if the price turns); by default the keeper closes it once the price has passed all the way through and pays what it holds. Returns: transactions[] (to, data, value in wei, gas), check (simulated, ok, failedStep, reason, ethNeeded, ethHeld), sendWithin, ifItReverts, slippagePct, the built prices, then (how to set the fill rule). 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 the price is on the wrong side of the market, or when the pool's steps move the prices by more than 1% (the built prices are returned; ask for them, or set acceptBuilt).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
poolNoA pool id from ladder_pools. Left out: the token's default pool.
sideYessell: hold the token over the price and sell as it rises. buy: hold the quote under the price and buy as it falls.
unitNoWhat price and priceTo are in: usd (default) or quote (the pool's quote asset a token).
ownerYesThe wallet that signs, sends, and owns the order.
priceYesThe limit price: dollars a token, or the pool's quote asset a token when unit is "quote". A sell's lies over the price now, a buy's under it.
rungsNoA range (priceTo given) only: how many rungs, 1 to 40; default 5.
shapeNoA range only: spot (even), curve (more where the order starts), bidask (more where it is complete).
tokenYesThe token's address.
amountYesHow much of the asset the order holds, as a decimal string: the token for a sell, the quote for a buy.
copyOfNoThe id of a ladder on the current contract this order copies: its owner is paid 0.1% while it stays open in the same pair.
priceToNoWhere the order is complete, further from the market than price. Left out: one rung, the narrowest the pool has.
referrerNoThe wallet that referred the owner: paid 0.1% of what goes in, out of the opening fee.
payWithEthNoA limit buy in a pool quoted in WETH: pay in plain ETH, wrapped inside the same transaction. Default: whenever the wallet holds less WETH than amount.
acceptBuiltNoPlace it at the prices the pool can hold even when they lie more than 1% from the prices asked for.
closeOnceFilledNoDefault true: the keeper closes the order once it is filled all the way through. The plan's `then` says how to set the rule once the order is placed.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed15 schema fields changed
    • changedInput schema / properties / acceptBuilt / description
      Previous value: -"Place it at the prices the pool can hold, however far they lie from the prices asked for"New value: +"Place it at the prices the pool can hold even when they lie more than 1% from the prices asked for."
    • changedInput schema / properties / amount / description
      Previous value: -"Of the asset the order holds, as a decimal string: the token for a sell, the quote for a buy"New value: +"How much of the asset the order holds, as a decimal string: the token for a sell, the quote for a buy."
    • changedInput schema / properties / closeOnceFilled / description
      Previous value: -"Default true: the plan's `then` says how to set the rule once the order is placed"New value: +"Default true: the keeper closes the order once it is filled all the way through. The plan's `then` says how to set the rule once the order is placed."
    • addedInput schema / properties / copyOf / description
      Added value: +"The id of a ladder on the current contract this order copies: its owner is paid 0.1% while it stays open in the same pair."
    • addedInput schema / properties / owner / description
      Added value: +"The wallet that signs, sends, and owns the order."
    • changedInput schema / properties / payWithEth / description
      Previous value: -"A limit buy in a pool quoted in WETH: pay in plain ETH, wrapped inside the same transaction. Default: whenever the wallet holds less WETH than the amount."New value: +"A limit buy in a pool quoted in WETH: pay in plain ETH, wrapped inside the same transaction. Default: whenever the wallet holds less WETH than amount."
    • changedInput schema / properties / pool / description
      Previous value: -"A pool from ladder_pools; the default pool when left out"New value: +"A pool id from ladder_pools. Left out: the token's default pool."
    • changedInput schema / properties / price / description
      Previous value: -"The limit price: dollars a token, or the pool's quote asset a token with unit \"quote\". A sell's is over the price now, a buy's under it."New value: +"The limit price: dollars a token, or the pool's quote asset a token when unit is \"quote\". A sell's lies over the price now, a buy's under it."
    • changedInput schema / properties / priceTo / description
      Previous value: -"Where the order is complete, further from the price than `price`. Left out: one rung, the narrowest the pool has."New value: +"Where the order is complete, further from the market than price. Left out: one rung, the narrowest the pool has."
    • addedInput schema / properties / referrer / description
      Added value: +"The wallet that referred the owner: paid 0.1% of what goes in, out of the opening fee."
    • changedInput schema / properties / rungs / description
      Previous value: -"A range only; 5 when left out"New value: +"A range (priceTo given) only: how many rungs, 1 to 40; default 5."
    • changedInput schema / properties / shape / description
      Previous value: -"A range only. spot: even; curve: more where the order starts; bidask: more where it is complete"New value: +"A range only: spot (even), curve (more where the order starts), bidask (more where it is complete)."
    • addedInput schema / properties / side / description
      Added value: +"sell: hold the token over the price and sell as it rises. buy: hold the quote under the price and buy as it falls."
    • addedInput schema / properties / token / description
      Added value: +"The token's address."
    • addedInput schema / properties / unit / description
      Added value: +"What price and priceTo are in: usd (default) or quote (the pool's quote asset a token)."
  2. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, but the description goes well beyond them: nothing is swapped at placing, the order earns pool fees while filling, part fills are not final and rungs trade back, the keeper closes on full fill, it costs quota units, and it must be sent within check.sendWithin or re-planned. This is rich lifecycle and operational context that annotations cannot convey.

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?

It is long, but front-loaded with purpose and every sentence carries distinct information (mechanics, lifecycle, returns, quota, errors). The return-field enumeration is dense but justified because there is no output schema. Slightly verbose, but no dead weight.

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 15-parameter mutation-planning tool with no output schema, the description supplies the missing return shape (transactions[], check, sendWithin, then), the error/refusal conditions, and the post-placement lifecycle. An agent has everything needed to plan and correctly hand off the unsigned transactions.

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 the baseline is 3, but the description adds meaning not in the schema: the acceptBuilt failure path (>1% price move, built prices returned), the default closeOnceFilled keeper rule and the 'then' field that sets it, and the significance of check.sendWithin. It stops short of annotating every one of the 15 parameters, hence 4 rather than 5.

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+resource ('Plans an order at a price and returns the unsigned transactions') and then defines the two modes (limit sell holds over the price, limit buy holds under it). It also names the siblings it is not (plan_ladder, plan_build for a band), so an agent can distinguish it without opening any schema.

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?

'Use when the wallet wants to buy or sell at a price, not now; for a band around the price use plan_ladder or plan_build' gives an explicit trigger and explicit alternatives. When-not and error conditions ('refused when the price is on the wrong side of the market') are also stated.

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