Skip to main content
Glama
recallnet

Trading Simulator MCP Server

by recallnet

get_quote

Retrieve trading quotes for token swaps across EVM and SVM blockchains. Specify source and destination tokens with amounts to get potential trade prices.

Instructions

Get a quote for a potential trade

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromTokenYesSource token address
toTokenYesDestination token address
amountYesAmount of fromToken to potentially trade
fromChainNoOptional blockchain type for source token
toChainNoOptional blockchain type for destination token
fromSpecificChainNoOptional specific chain for source token
toSpecificChainNoOptional specific chain for destination token

Implementation Reference

  • MCP tool handler for 'get_quote': validates input arguments, extracts parameters, calls tradingClient.getQuote, and returns the JSON-formatted response.
    case "get_quote": { if (!args || typeof args !== "object" || !("fromToken" in args) || !("toToken" in args) || !("amount" in args)) { throw new Error("Invalid arguments for get_quote"); } const fromToken = args.fromToken as string; const toToken = args.toToken as string; const amount = args.amount as string; const fromChain = "fromChain" in args ? args.fromChain as BlockchainType : undefined; const toChain = "toChain" in args ? args.toChain as BlockchainType : undefined; const fromSpecificChain = "fromSpecificChain" in args ? args.fromSpecificChain as SpecificChain : undefined; const toSpecificChain = "toSpecificChain" in args ? args.toSpecificChain as SpecificChain : undefined; const response = await tradingClient.getQuote( fromToken, toToken, amount, fromChain, toChain, fromSpecificChain, toSpecificChain ); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }], isError: false }; }
  • Tool schema definition for 'get_quote' including input schema with required fields fromToken, toToken, amount and optional chain parameters.
    { name: "get_quote", description: "Get a quote for a potential trade", inputSchema: { type: "object", properties: { fromToken: { type: "string", description: "Source token address" }, toToken: { type: "string", description: "Destination token address" }, amount: { type: "string", description: "Amount of fromToken to potentially trade" }, fromChain: { type: "string", enum: ["svm", "evm"], description: "Optional blockchain type for source token" }, toChain: { type: "string", enum: ["svm", "evm"], description: "Optional blockchain type for destination token" }, fromSpecificChain: { type: "string", enum: ["eth", "polygon", "bsc", "arbitrum", "base", "optimism", "avalanche", "linea", "svm"], description: "Optional specific chain for source token" }, toSpecificChain: { type: "string", enum: ["eth", "polygon", "bsc", "arbitrum", "base", "optimism", "avalanche", "linea", "svm"], description: "Optional specific chain for destination token" } }, required: ["fromToken", "toToken", "amount"], additionalProperties: false, $schema: "http://json-schema.org/draft-07/schema#" } },
  • src/index.ts:411-415 (registration)
    Registers the list of tools including 'get_quote' via the ListToolsRequestHandler.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TRADING_SIM_TOOLS }; });
  • Helper method in TradingSimulatorClient that makes the actual API request to /api/trade/quote with query parameters and handles response or error.
    async getQuote( fromToken: string, toToken: string, amount: string, fromChain?: BlockchainType, toChain?: BlockchainType, fromSpecificChain?: SpecificChain, toSpecificChain?: SpecificChain ): Promise<QuoteResponse | ErrorResponse> { const params = new URLSearchParams(); params.append('fromToken', fromToken); params.append('toToken', toToken); params.append('amount', amount); if (fromChain) { params.append('fromChain', fromChain); } if (toChain) { params.append('toChain', toChain); } if (fromSpecificChain) { params.append('fromSpecificChain', fromSpecificChain); } if (toSpecificChain) { params.append('toSpecificChain', toSpecificChain); } return this.request<QuoteResponse>( 'GET', `/api/trade/quote?${params.toString()}`, null, 'get quote' ); }

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/recallnet/trading-simulator-mcp'

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