get_gasless_quote
Obtain a gasless token swap quote with executable EIP-712 signature data for DeFi trades across multiple blockchains. Supports defined slippage and token pairs.
Instructions
Get executable quote for a gasless token swap with EIP-712 signature data
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| buyToken | Yes | Contract address of token to buy | |
| chainId | Yes | Blockchain ID (e.g., 8453 for Base) | |
| sellAmount | Yes | Amount of sellToken in base units | |
| sellToken | Yes | Contract address of token to sell | |
| slippageBps | No | Maximum acceptable slippage in basis points (optional, min: 30) | |
| taker | No | Address executing the trade (required for gasless quotes, uses USER_ADDRESS from env if not provided) |
Input Schema (JSON Schema)
{
"properties": {
"buyToken": {
"description": "Contract address of token to buy",
"type": "string"
},
"chainId": {
"description": "Blockchain ID (e.g., 8453 for Base)",
"type": "integer"
},
"sellAmount": {
"description": "Amount of sellToken in base units",
"type": "string"
},
"sellToken": {
"description": "Contract address of token to sell",
"type": "string"
},
"slippageBps": {
"description": "Maximum acceptable slippage in basis points (optional, min: 30)",
"type": "integer"
},
"taker": {
"description": "Address executing the trade (required for gasless quotes, uses USER_ADDRESS from env if not provided)",
"type": "string"
}
},
"required": [
"chainId",
"buyToken",
"sellToken",
"sellAmount"
],
"type": "object"
}
Implementation Reference
- src/toolService.js:433-469 (handler)Primary MCP tool handler for 'get_gasless_quote'. Validates params, sets taker address from userAddress if missing, calls agService.getGaslessQuote, and returns formatted response with metadata.async getGaslessQuote(params) { const { chainId, buyToken, sellToken, sellAmount } = params; if (!chainId || !buyToken || !sellToken || !sellAmount) { throw new Error( "Missing required parameters: chainId, buyToken, sellToken, sellAmount" ); } // Add taker address if not provided (required for gasless quotes) const quoteParams = { ...params, taker: params.taker || this.userAddress, }; if (!quoteParams.taker) { throw new Error("Taker address is required for gasless quotes"); } const result = await this.agg.getGaslessQuote(quoteParams); return { message: "Gasless swap quote retrieved successfully", data: result, nextSteps: [ "1. Review the quote details including approval and trade objects", "2. Use submit_gasless_swap tool to execute this gasless swap", "3. Both approval and trade signatures will be handled automatically", ], gaslessInfo: { hasApproval: !!result.approval, hasTrade: !!result.trade, approvalType: result.approval?.type, tradeType: result.trade?.type, }, }; }
- src/index.js:669-705 (schema)Input schema definition for the get_gasless_quote tool, including properties, descriptions, and required fields.{ name: TOOL_NAMES.GET_GASLESS_QUOTE, description: "Get executable quote for a gasless token swap with EIP-712 signature data", inputSchema: { type: "object", properties: { chainId: { type: "integer", description: "Blockchain ID (e.g., 8453 for Base)", }, buyToken: { type: "string", description: "Contract address of token to buy", }, sellToken: { type: "string", description: "Contract address of token to sell", }, sellAmount: { type: "string", description: "Amount of sellToken in base units", }, taker: { type: "string", description: "Address executing the trade (required for gasless quotes, uses USER_ADDRESS from env if not provided)", }, slippageBps: { type: "integer", description: "Maximum acceptable slippage in basis points (optional, min: 30)", }, }, required: ["chainId", "buyToken", "sellToken", "sellAmount"], }, },
- src/index.js:1142-1144 (registration)Registration in the MCP tool request handler switch statement, dispatching calls to toolService.getGaslessQuote.case TOOL_NAMES.GET_GASLESS_QUOTE: result = await toolService.getGaslessQuote(args); break;
- src/services/agService.js:139-157 (helper)Helper service method in agService that performs the actual HTTP fetch to the aggregator API endpoint for gasless quote.async getGaslessQuote(params) { try { const queryParams = new URLSearchParams(params); const response = await fetch(`${this.baseUrl}/api/swap/gasless/quote?${queryParams}`); if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); } const data = await response.json(); if (!data.success) { throw new Error(data.error || 'Gasless quote request failed'); } return data.data; } catch (error) { throw new Error(`Failed to get gasless quote: ${error.message}`); }
- src/constants.js:12-12 (helper)Constant definition mapping GET_GASLESS_QUOTE to the tool name string 'get_gasless_quote'.GET_GASLESS_QUOTE: "get_gasless_quote",