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; }

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