get_quote
Generate a trade quote by specifying source and destination tokens, amount, and optional blockchain details for accurate simulation and analysis.
Instructions
Get a quote for a potential trade
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount of fromToken to potentially trade | |
| fromChain | No | Optional blockchain type for source token | |
| fromSpecificChain | No | Optional specific chain for source token | |
| fromToken | Yes | Source token address | |
| toChain | No | Optional blockchain type for destination token | |
| toSpecificChain | No | Optional specific chain for destination token | |
| toToken | Yes | Destination token address |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"amount": {
"description": "Amount of fromToken to potentially trade",
"type": "string"
},
"fromChain": {
"description": "Optional blockchain type for source token",
"enum": [
"svm",
"evm"
],
"type": "string"
},
"fromSpecificChain": {
"description": "Optional specific chain for source token",
"enum": [
"eth",
"polygon",
"bsc",
"arbitrum",
"base",
"optimism",
"avalanche",
"linea",
"svm"
],
"type": "string"
},
"fromToken": {
"description": "Source token address",
"type": "string"
},
"toChain": {
"description": "Optional blockchain type for destination token",
"enum": [
"svm",
"evm"
],
"type": "string"
},
"toSpecificChain": {
"description": "Optional specific chain for destination token",
"enum": [
"eth",
"polygon",
"bsc",
"arbitrum",
"base",
"optimism",
"avalanche",
"linea",
"svm"
],
"type": "string"
},
"toToken": {
"description": "Destination token address",
"type": "string"
}
},
"required": [
"fromToken",
"toToken",
"amount"
],
"type": "object"
}
Implementation Reference
- src/index.ts:305-348 (registration)Tool registration for 'get_quote' including name, description, and input schema definition.{ 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:577-605 (handler)Handler implementation for the 'get_quote' tool within the CallToolRequestSchema switch statement. Validates input arguments and delegates execution to tradingClient.getQuote before formatting and returning the 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/types.ts:228-245 (schema)TypeScript interface defining the expected output structure (QuoteResponse) for the get_quote tool response.export interface QuoteResponse extends ApiResponse { fromToken: string; toToken: string; fromAmount: number; toAmount: number; exchangeRate: number; slippage: number; prices: { fromToken: number; toToken: number; }; chains: { fromChain: BlockchainType; toChain: BlockchainType; }; fromSpecificChain?: string; toSpecificChain?: string; }