Skip to main content
Glama

Build a trade for your wallet

build_trade
Read-only

The trade's transaction for your wallet to sign, as the coin's page builds it: { transaction, out, minOut }, the transaction base64 (unsigned, version 0, paid by your wallet). It changes nothing until your wallet signs it and it is sent. A coin paired with $SOUVENIR (get_coin's pair) trades in SOL the same way: one transaction swaps through $SOUVENIR, and keepsSouv, a little $SOUVENIR, stays in your wallet. pay: 'souvenir' trades it in $SOUVENIR you hold instead: the amount of a buy, and out and minOut of a sell, are then raw $SOUVENIR (6 decimals). Trading a coin, in order: (1) quote_trade to see what you would get; (2) build_trade with your wallet's address; (3) sign the transaction it answers with your wallet; (4) send_transaction, or send it yourself through any Solana RPC. No sign-in: your wallet's signature is the approval, and Souvenir never needs its private key. The same fees and limits as the coin's page on souvenir.finance. An agent helping a person, which can't sign with their wallet, uses request_trade instead and gives them the link to approve it with their own wallet.

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>",
      "wallet": "<wallet>"
    },
    "name": "build_trade"
  }
}

Input Schema

NameRequiredDescriptionDefault
payNoWhat a coin paired with $SOUVENIR is paid in (a sell: what it receives): sol, the default, or souvenir. Any other coin takes sol only.
mintYesThe coin's mint address (base58).
sideYesbuy: spend SOL for the coin. sell: the coin for SOL. With pay souvenir, $SOUVENIR in place of SOL.
amountYesWhat you give, in whole units, as a string: lamports for a buy (1 SOL is 1000000000), the coin's raw units for a sell (Souvenir's and pump.fun's coins have 6 decimals: 1 coin is 1000000). With pay souvenir, a buy's is raw $SOUVENIR (6 decimals).
walletYesYour Solana wallet's address (base58): it pays, signs and receives.
slippageBpsNoThe most the price may move against you before the trade refuses, in basis points (300 is 3%, the site's default).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / amount / description
      Previous value: -"What you give, in whole units, as a string: lamports for a buy (1 SOL is 1000000000), the coin's raw units for a sell (Souvenir's and pump.fun's coins have 6 decimals: 1 coin is 1000000)."New value: +"What you give, in whole units, as a string: lamports for a buy (1 SOL is 1000000000), the coin's raw units for a sell (Souvenir's and pump.fun's coins have 6 decimals: 1 coin is 1000000). With pay souvenir, a buy's is raw $SOUVENIR (6 decimals)."
    • addedInput schema / properties / pay
      Added value: +{
      +  "description": "What a coin paired with $SOUVENIR is paid in (a sell: what it receives): sol, the default, or souvenir. Any other coin takes sol only.",
      +  "enum": [
      +    "sol",
      +    "souvenir"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / side / description
      Previous value: -"buy: spend SOL for the coin. sell: the coin for SOL."New value: +"buy: spend SOL for the coin. sell: the coin for SOL. With pay souvenir, $SOUVENIR in place of SOL."
  2. Added

TDQS

A4.8/5.0
Behavior5/5

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

Beyond readOnlyHint/openWorldHint, it discloses that nothing changes until the wallet signs and the transaction is sent, that no sign-in or private key is needed, that fees and limits match the site, and the $SOUVENIR routing behavior including the keptSouv remainder. This is unusually rich behavioral context that stays consistent with the readOnly annotation.

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 return shape and the 'changes nothing until signed' caveat are front-loaded, and the numbered workflow is easy to scan. It is somewhat dense and slightly repetitive on signing/no-sign-in, and the opening sentence is convoluted, but little is genuinely wasted.

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?

With six parameters at full schema coverage and no output schema, the description supplies the missing piece by describing the returned { transaction, out, minOut } and the downstream signing/sending path. Nothing an agent needs to call it 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 the baseline is 3, but the description adds genuine meaning: pay:'souvenir' makes a buy's amount and a sell's out/minOut raw 6-decimal $SOUVENIR, and the souvenir path only applies to coins paired with $SOUVENIR. It also clarifies the wallet pays, signs and receives.

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 and artifact: it builds the swap transaction (base64, unsigned, version 0) for the user's wallet to sign, returning { transaction, out, minOut }. It clearly distinguishes itself from quote_trade (preview), send_transaction (broadcast) and request_trade (for agents that cannot sign).

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 ordered workflow: (1) quote_trade, (2) build_trade with the wallet address, (3) sign, (4) send_transaction or any Solana RPC. It also names the exclusion case and the alternative: an agent that cannot sign should use request_trade and hand the user an approval link.

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