Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_gasless_quote

Generate executable quotes for token swaps without paying gas fees by providing EIP-712 signature data for blockchain trading operations.

Instructions

Get executable quote for a gasless token swap with EIP-712 signature data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainIdYesBlockchain ID (e.g., 8453 for Base)
buyTokenYesContract address of token to buy
sellTokenYesContract address of token to sell
sellAmountYesAmount of sellToken in base units
takerNoAddress executing the trade (required for gasless quotes, uses USER_ADDRESS from env if not provided)
slippageBpsNoMaximum acceptable slippage in basis points (optional, min: 30)

Implementation Reference

  • Primary MCP tool handler: validates params, ensures taker address, delegates to AgService.getGaslessQuote, formats MCP response with next steps and gasless info
    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, }, }; }
  • Input schema and metadata definition for the get_gasless_quote tool in MCP ListTools response
    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)
    MCP server switch case registration that calls ToolService.getGaslessQuote
    case TOOL_NAMES.GET_GASLESS_QUOTE: result = await toolService.getGaslessQuote(args); break;
  • AgService helper: Makes HTTP request to aggregator's /api/swap/gasless/quote endpoint and handles response/error
    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 (registration)
    Tool name constant definition used for registration and dispatch
    GET_GASLESS_QUOTE: "get_gasless_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/edkdev/defi-trading-mcp'

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