Skip to main content
Glama

helius_execute_jupiter_swap

Swap tokens on Solana using Jupiter DEX aggregator. Specify input/output tokens, amount, and signer to execute trades.

Instructions

Execute a token swap using Jupiter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputMintYesThe mint address of the input token
outputMintYesThe mint address of the output token
amountYesThe amount of input tokens to swap
maxDynamicSlippageBpsNoMaximum slippage in basis points (optional)
signerYesThe signer public key

Implementation Reference

  • The main handler function that executes the Jupiter swap using Helius RPC, validates inputs, calls rpc.executeJupiterSwap, and handles responses/errors.
    export const executeJupiterSwapHandler = async (input: ExecuteJupiterSwapInput): Promise<ToolResultSchema> => {
      try {
        // Validate the signer is a valid public key format
        const signerPublicKey = validatePublicKey(input.signer);
        if (!(signerPublicKey instanceof PublicKey)) {
          return signerPublicKey;
        }
    
        const params = {
          inputMint: input.inputMint,
          outputMint: input.outputMint,
          amount: input.amount,
          maxDynamicSlippageBps: input.maxDynamicSlippageBps
        };
    
        // The actual implementation expects a Signer object, but our mock likely accepts a string
        // We'll use the string and let the type casting handle it
        const result = await (helius as any as Helius).rpc.executeJupiterSwap(params, input.signer as any);
        return createSuccessResponse(`Jupiter swap executed: ${JSON.stringify(result, null, 2)}`);
      } catch (error) {
        return createErrorResponse(`Error executing Jupiter swap: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Input schema definition for the 'helius_execute_jupiter_swap' tool, defining parameters like inputMint, outputMint, amount, slippage, and signer.
    {
      name: 'helius_execute_jupiter_swap',
      description: 'Execute a token swap using Jupiter',
      inputSchema: {
        type: 'object',
        properties: {
          inputMint: { type: 'string', description: 'The mint address of the input token' },
          outputMint: { type: 'string', description: 'The mint address of the output token' },
          amount: { type: 'number', description: 'The amount of input tokens to swap' },
          maxDynamicSlippageBps: { type: 'number', description: 'Maximum slippage in basis points (optional)' },
          signer: { type: 'string', description: 'The signer public key' }
        },
        required: ['inputMint', 'outputMint', 'amount', 'signer']
      }
    }
  • src/tools.ts:590-590 (registration)
    Registration of the tool name to its handler function in the handlers dictionary.
    "helius_execute_jupiter_swap": executeJupiterSwapHandler
  • TypeScript type definition for the ExecuteJupiterSwapInput used in the handler function signature.
    export type ExecuteJupiterSwapInput = {
      inputMint: string;
      outputMint: string;
      amount: number;
      maxDynamicSlippageBps?: number;
      signer: string;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. 'Execute a token swap' implies a write/mutation operation with potential financial implications, but the description doesn't disclose critical behavioral traits like authentication requirements, rate limits, cost implications, error handling, or what happens on success/failure. This is inadequate for a tool that likely involves blockchain transactions.

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?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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?

Given the complexity of a token swap tool (likely involving blockchain writes, financial risks, and no output schema), the description is incomplete. It lacks behavioral context, usage guidelines, and output details, making it insufficient for safe and effective use by an AI agent in a real-world scenario.

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 the schema already documents all parameters thoroughly. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain Jupiter-specific nuances or parameter interactions). 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.

Purpose4/5

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

The description clearly states the action ('Execute a token swap') and the resource/mechanism ('using Jupiter'), which provides a specific verb+resource combination. However, it doesn't differentiate this tool from potential alternatives like 'helius_send_jito_bundle' or other swap-related tools that might exist in other contexts, though none are listed among siblings.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, constraints, or compare it to sibling tools (e.g., other Helius tools for querying vs. executing). This leaves the agent with minimal context for decision-making.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dcSpark/mcp-server-helius'

If you have feedback or need assistance with the MCP directory API, please join our Discord server