Skip to main content
Glama

hyperd.dex.quote

Compare swap quotes from Paraswap and 0x aggregators to find the route with the highest output. Returns per-source quotes and best route, with a fixed cost of $0.02 in USDC.

Instructions

Get the best DEX swap route across multiple aggregators (Paraswap + 0x). Returns the highest output amount and per-source quotes. Costs $0.02 in USDC.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYesSource token symbol or contract address
toYesDestination token symbol or contract address
amountYesDecimal amount of source token
chainNoChain. Default 'base'.
slippageNoMax slippage in basis points. Default 50.
takerNoOptional payer address for 0x quote (improves accuracy)

Implementation Reference

  • src/server.ts:294-306 (registration)
    Registration of the 'hyperd.dex.quote' tool using the MCP server.tool() method. Defines schema (from, to, amount, chain, slippage, taker) and handler (calls paidGet('/api/dex/quote', args)).
    server.tool(
      "hyperd.dex.quote",
      "Get the best DEX swap route across multiple aggregators (Paraswap + 0x). Returns the highest output amount and per-source quotes. Costs $0.02 in USDC.",
      {
        from: z.string().describe("Source token symbol or contract address"),
        to: z.string().describe("Destination token symbol or contract address"),
        amount: z.string().describe("Decimal amount of source token"),
        chain: z.enum(["base", "ethereum", "polygon", "arbitrum", "optimism", "avalanche", "bnb"]).optional().describe("Chain. Default 'base'."),
        slippage: z.number().int().optional().describe("Max slippage in basis points. Default 50."),
        taker: z.string().optional().describe("Optional payer address for 0x quote (improves accuracy)"),
      },
      async (args) => asText(await paidGet("/api/dex/quote", args)),
    );
  • Handler implementation: async (args) => asText(await paidGet('/api/dex/quote', args)). Delegates to paidGet() which performs an x402 payment flow to the API endpoint.
      async (args) => asText(await paidGet("/api/dex/quote", args)),
    );
  • Input schema using Zod. Parameters: from (string - source token), to (string - destination token), amount (string - decimal amount), chain (enum, optional - default base), slippage (number, optional - basis points, default 50), taker (string, optional - payer address for 0x quote).
    {
      from: z.string().describe("Source token symbol or contract address"),
      to: z.string().describe("Destination token symbol or contract address"),
      amount: z.string().describe("Decimal amount of source token"),
      chain: z.enum(["base", "ethereum", "polygon", "arbitrum", "optimism", "avalanche", "bnb"]).optional().describe("Chain. Default 'base'."),
      slippage: z.number().int().optional().describe("Max slippage in basis points. Default 50."),
      taker: z.string().optional().describe("Optional payer address for 0x quote (improves accuracy)"),
    },
  • paidGet helper: constructs URL with query params from args, calls paidRequest('GET', url, undefined) which handles the x402 payment dance (HTTP 402 -> payment -> retry).
    async function paidGet(
      path: string,
      query: Record<string, string | number | boolean | undefined>,
    ): Promise<unknown> {
      if (!httpClient) {
        throw new Error(WALLET_NOT_CONFIGURED_MSG);
      }
    
      const url = new URL(`${API_BASE}${path}`);
      for (const [k, v] of Object.entries(query)) {
        if (v !== undefined && v !== "" && v !== null) url.searchParams.set(k, String(v));
      }
      return paidRequest("GET", url, undefined);
    }
  • asText helper: wraps data in MCP content response format { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }.
    function asText(data: unknown) {
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses cost ($0.02 USDC) and summarizes output (highest output amount and per-source quotes). It could mention that it does not execute trades, but the read-only nature is implied.

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?

Two short sentences convey purpose, scope, and cost with no fluff. Front-loaded and efficient.

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?

For a quoting tool with 6 params and no output schema, the description covers key aspects: what it does, what it returns, and cost. Lacks details on error handling or return structure, but sufficient for basic usage.

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%, so baseline is 3. Description adds value by explaining aggregator usage and output, but does not elaborate on individual parameters beyond what schema provides. Adequate but not exceptional.

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?

Description clearly states the tool gets the best DEX swap route across multiple aggregators and returns highest output and per-source quotes. The name and description together differentiate it from sibling tools like pricing.get or token.info.

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

Usage Guidelines4/5

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

Description indicates when to use (to obtain optimal swap quotes) but does not explicitly state when not to use or mention alternatives. However, the context is clear for a quoting 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/hyperd-ai/hyperd-mcp'

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