Skip to main content
Glama

jupiter_swap_quote

Get the best swap quote by aggregating prices from multiple Solana DEX routers. Specify tokens, amount, wallet, and slippage to receive an optimized quote.

Instructions

Get a swap quote via Jupiter's managed /order path. Returns the best price across all routers (Metis, RFQ, Dflow, OKX).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputMintYesMint address of token to sell (SOL: So11111111111111111111111111111111111111112)
outputMintYesMint address of token to buy (USDC: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v)
amountYesAmount in smallest unit (lamports). For 1 SOL: '1000000000'
takerYesWallet address executing the swap
slippageBpsNoMax slippage in basis points (default 50 = 0.5%)

Implementation Reference

  • The handler function for jupiter_swap_quote — calls client.swapOrder(args) with the user's input (inputMint, outputMint, amount, taker, slippageBps) and returns the JSON-stringified result.
    register(
      "jupiter_swap_quote",
      "Get a swap quote via Jupiter's managed /order path. Returns the best price across all routers (Metis, RFQ, Dflow, OKX).",
      {
        inputMint: z.string().describe("Mint address of token to sell (SOL: So11111111111111111111111111111111111111112)"),
        outputMint: z.string().describe("Mint address of token to buy (USDC: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v)"),
        amount: z.string().describe("Amount in smallest unit (lamports). For 1 SOL: '1000000000'"),
        taker: z.string().describe("Wallet address executing the swap"),
        slippageBps: z.number().optional().describe("Max slippage in basis points (default 50 = 0.5%)"),
      },
      async (args) => {
        const result = await client.swapOrder(args);
        return JSON.stringify(result, null, 2);
      },
    );
  • Zod schema defining the 5 input parameters: inputMint (string), outputMint (string), amount (string), taker (string), slippageBps (optional number).
    {
      inputMint: z.string().describe("Mint address of token to sell (SOL: So11111111111111111111111111111111111111112)"),
      outputMint: z.string().describe("Mint address of token to buy (USDC: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v)"),
      amount: z.string().describe("Amount in smallest unit (lamports). For 1 SOL: '1000000000'"),
      taker: z.string().describe("Wallet address executing the swap"),
      slippageBps: z.number().optional().describe("Max slippage in basis points (default 50 = 0.5%)"),
    },
  • src/tools/swap.ts:6-20 (registration)
    Registration of the tool named 'jupiter_swap_quote' via the register function, which internally calls server.tool() on the MCP server.
    register(
      "jupiter_swap_quote",
      "Get a swap quote via Jupiter's managed /order path. Returns the best price across all routers (Metis, RFQ, Dflow, OKX).",
      {
        inputMint: z.string().describe("Mint address of token to sell (SOL: So11111111111111111111111111111111111111112)"),
        outputMint: z.string().describe("Mint address of token to buy (USDC: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v)"),
        amount: z.string().describe("Amount in smallest unit (lamports). For 1 SOL: '1000000000'"),
        taker: z.string().describe("Wallet address executing the swap"),
        slippageBps: z.number().optional().describe("Max slippage in basis points (default 50 = 0.5%)"),
      },
      async (args) => {
        const result = await client.swapOrder(args);
        return JSON.stringify(result, null, 2);
      },
    );
  • src/index.ts:40-58 (registration)
    The generic register() helper that maps to McpServer.tool(), used to register the jupiter_swap_quote tool.
    function register(
      name: string,
      description: string,
      shape: Record<string, z.ZodType>,
      handler: (args: any) => Promise<string>,
    ) {
      server.tool(name, description, shape, async (args) => {
        try {
          const text = await handler(args);
          return { content: [{ type: "text" as const, text }] };
        } catch (err: any) {
          return {
            content: [{ type: "text" as const, text: `Error: ${err.message}` }],
            isError: true,
          };
        }
      });
      toolCount++;
    }
  • The underlying JupiterClient method swapOrder() that makes the actual GET request to /swap/v2/order on the Jupiter API.
    /** Get a quote + assembled transaction via managed /order path */
    async swapOrder(params: {
      inputMint: string;
      outputMint: string;
      amount: string;
      taker: string;
      slippageBps?: number;
      referralAccount?: string;
      referralFee?: number;
    }) {
      return this.request("/swap/v2/order", { params: params as any });
    }
Behavior4/5

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

No annotations are provided, so the description must convey behavioral traits. It states 'Get a swap quote' and 'Returns the best price', which strongly implies a read-only operation without state changes. However, it could be more explicit about the lack of mutation and does not mention rate limits or error conditions.

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 two concise sentences with no redundant information. It front-loads the core purpose and adds an important detail about which routers are used, making it easy for an AI agent to quickly grasp the tool's function.

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?

While the description covers the core functionality and router selection, it lacks details about the output format (e.g., fields like price, route, fees) since no output schema is provided. This omission may require an agent to infer response structure from context. Overall, it is mostly complete for a quote tool.

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?

The input schema already describes all 5 parameters with clear descriptions and examples (e.g., SOL and USDC addresses, lamports for amount). The description adds no additional information about parameter meaning or usage beyond what the schema provides.

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 clearly states the tool retrieves a swap quote via Jupiter's managed /order path, specifying it returns the best price across multiple routers (Metis, RFQ, Dflow, OKX). This distinguishes it from related sibling tools like jupiter_swap_build (which builds/executes swaps) and jupiter_dca_create (for DCA orders).

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

Usage Guidelines3/5

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

The description implies use for obtaining a quote before building a swap, but does not explicitly state when to use this tool versus siblings such as jupiter_swap_build or jupiter_price. There is no guidance on prerequisites, order of operations, or when to avoid this tool.

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/ExpertVagabond/jupiter-mcp'

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