Skip to main content
Glama

swap

Construct a base64-encoded Solana transaction to buy or sell tokens via a bonding curve, specifying a minimum output amount for slippage protection.

Instructions

Create a swap transaction (returns base64 transaction)

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": {
      "bondingCurveBucket": "<bondingCurveBucket>",
      "amountIn": "<amountIn>",
      "minAmountOut": "<minAmountOut>",
      "direction": "<direction>",
      "authority": "<authority>"
    },
    "name": "swap"
  }
}

Input Schema

NameRequiredDescriptionDefault
amountInYesThe input amount as a string (in lamports/base units)
authorityYesThe public key of the authority (user wallet)
directionYesSwap direction: 'Buy' (SOL to tokens) or 'Sell' (tokens to SOL)
minAmountOutYesThe minimum output amount as a string (for slippage protection)
bondingCurveBucketYesThe public key of the bonding curve bucket

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

B3.1/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full burden; it does disclose the key behavioral fact that this constructs and returns a base64 transaction rather than executing the swap, which is genuinely useful. It says nothing about signing requirements, fee payer, slippage enforcement via minAmountOut, or whether the returned transaction expires.

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 compact line with the return-value clarification front-loaded and no wasted words. It is efficient, though its brevity leaves the definition under-specified rather than optimally sized.

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

Completeness2/5

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

For a five-required-parameter transaction-construction tool with no annotations and no output schema, the description should at minimum explain the quote relationship and what the caller must do with the base64 result. Only the return type is covered, leaving the operational contract largely unstated.

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%, with every parameter documented including the Buy/Sell enum and the lamports/base-units convention, so the schema does the heavy lifting. The description adds no additional meaning about parameter interactions, such as how minAmountOut relates to the quote output.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Create a swap transaction" is a specific verb plus resource, and the parenthetical clarifies the output is a base64 transaction rather than a submitted swap. It does not distinguish itself from the sibling get_swap_quote, so an agent must infer the quote-then-swap relationship.

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

Usage Guidelines2/5

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

There is no guidance on when to call this versus get_swap_quote, no statement that a quote should be obtained first, and no prerequisites such as a funded authority or an existing bonding curve. The agent is left to infer the workflow entirely.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.