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
| Name | Required | Description | Default |
|---|---|---|---|
| fromToken | Yes | Source token address | |
| toToken | Yes | Destination token address | |
| amount | Yes | Amount of fromToken to potentially trade | |
| fromChain | No | Optional blockchain type for source token | |
| toChain | No | Optional blockchain type for destination token | |
| fromSpecificChain | No | Optional specific chain for source token | |
| toSpecificChain | No | Optional specific chain for destination token |
Implementation Reference
- src/index.ts:577-605 (handler)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 }; }
- src/index.ts:305-348 (schema)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 }; });
- src/api-client.ts:491-527 (helper)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' ); }