Skip to main content
Glama

get_quote

Obtain swap quotes for token trading on Casper Network, showing amounts, price impact, and routing paths before executing trades.

Instructions

Get a swap quote for trading between two tokens. Returns amounts, price impact, and routing path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_inYesInput token: symbol (e.g., "CSPR"), name, or contract hash
token_outYesOutput token: symbol (e.g., "USDT"), name, or contract hash
amountYesHuman-readable amount (e.g., "100" for 100 CSPR)
typeYes"exact_in" = specify input amount, "exact_out" = specify desired output amount

Implementation Reference

  • Registration of the 'get_quote' tool within the MCP server, defining its schema and handler function.
    server.tool(
      'get_quote',
      'Get a swap quote for trading between two tokens. Returns amounts, price impact, and routing path.',
      {
        token_in: z.string().describe('Input token: symbol (e.g., "CSPR"), name, or contract hash'),
        token_out: z.string().describe('Output token: symbol (e.g., "USDT"), name, or contract hash'),
        amount: z.string().describe('Human-readable amount (e.g., "100" for 100 CSPR)'),
        type: z.enum(['exact_in', 'exact_out']).describe('"exact_in" = specify input amount, "exact_out" = specify desired output amount'),
      },
      async ({ token_in, token_out, amount, type }) => {
        const quote = await client.getQuote({ tokenIn: token_in, tokenOut: token_out, amount, type });
        return { content: [{ type: 'text' as const, text: JSON.stringify(quote, null, 2) }] };
      },
    );
  • Handler implementation for 'get_quote' which calls client.getQuote.
    async ({ token_in, token_out, amount, type }) => {
      const quote = await client.getQuote({ tokenIn: token_in, tokenOut: token_out, amount, type });
      return { content: [{ type: 'text' as const, text: JSON.stringify(quote, null, 2) }] };
    },

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/make-software/cspr-trade-mcp'

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