Skip to main content
Glama

Prepare trade

prepare_trade
Read-only

Build an UNSIGNED buy or sell transaction (base64, legacy format) for the given wallet. This does not execute the trade or move funds. To execute it, sign with that wallet and broadcast to Solana before lastValidBlockHeight. Never send a private key to this tool or any other.

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": {
      "mint": "<mint>",
      "side": "<side>",
      "amount": "<amount>",
      "walletPublicKey": "<walletPublicKey>"
    },
    "name": "prepare_trade"
  }
}

Input Schema

NameRequiredDescriptionDefault
mintYesToken mint address (base58)
sideYesTrade direction
amountYesPositive integer as a string. buy: SOL in lamports (1 SOL = 1000000000). sell: raw token units (6 decimals, 1 token = 1000000)
slippageBpsNoSlippage tolerance in basis points, up to 500 (5%). Default 100 (1%). A sandwich bot can take up to the whole tolerance, so keep it tight
walletPublicKeyYesPublic address of the wallet that will sign and pay (base58)
priorityFeeMicroLamportsNoPriority fee per compute unit, in micro-lamports. Default 10000. Raise it if trades aren't landing when Solana is busy; the maximum adds at most 0.00025 SOL

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / slippageBps / description
      Previous value: -"Slippage tolerance in basis points. Default 300 (3%)"New value: +"Slippage tolerance in basis points, up to 500 (5%). Default 100 (1%). A sandwich bot can take up to the whole tolerance, so keep it tight"
    • changedInput schema / properties / slippageBps / maximum
      Previous value: -5000New value: +500
  2. Changed1 schema field changed
    • addedInput schema / properties / priorityFeeMicroLamports
      Added value: +{
      +  "description": "Priority fee per compute unit, in micro-lamports. Default 10000. Raise it if trades aren't landing when Solana is busy; the maximum adds at most 0.00025 SOL",
      +  "maximum": 1000000,
      +  "minimum": 0,
      +  "type": "integer"
      +}
  3. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Beyond the annotations, the description discloses that the output is an unsigned legacy-format base64 transaction, that it has an expiry constraint (lastValidBlockHeight), and it adds an important security guardrail about never sending a private key. It doesn't cover failure modes such as insufficient balance or how the transaction's lifetime is determined. No contradiction with readOnlyHint=true, since the tool only constructs, never submits.

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

Conciseness5/5

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

Four short sentences, zero waste: capability first, non-execution caveat second, required follow-up third, security warning last. Everything is front-loaded and each sentence carries distinct information.

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 mutation-adjacent tool with no output schema, the description does enough: it names the return shape (base64 unsigned legacy transaction), the expiry mechanism, and the signing handoff. A mention of what the response includes besides the transaction (e.g. the block height value) would close the last gap, but an agent can call this correctly with what's here.

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 description coverage is 100%, so mint, side, amount, slippageBps, walletPublicKey and priorityFeeMicroLamports are already fully documented in the schema. The description only echoes 'buy or sell' and 'given wallet' and adds no format or sizing detail beyond it. Baseline 3 applies when the schema carries the full param semantics.

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?

States a specific verb and resource — 'Build an UNSIGNED buy or sell transaction' — plus the payload format (base64, legacy) and the wallet it's bound to. It immediately distinguishes itself from execution-oriented operations and from the quote/market siblings by explicitly saying it does not execute or move funds.

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?

It clearly defines the downstream workflow (sign with that wallet, broadcast before lastValidBlockHeight) and rules out any expectation that this tool executes. It does not explicitly say to call get_quote first when sizing a trade, so the routing to the sibling tools is implied rather than 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