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",
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'executable quote' and 'EIP-712 signature data', hinting at a read-only operation that prepares for execution, but fails to clarify if this is a simulation, whether it requires specific permissions, rate limits, or what the output entails (e.g., quote validity, signature details). This leaves significant gaps for a tool with potential transactional implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that efficiently conveys the core purpose without unnecessary words. Every part of the sentence earns its place by specifying key aspects like 'executable', 'gasless', and 'EIP-712 signature data'.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a gasless swap tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., safety, side effects), output format, or how the quote integrates with execution tools like execute_swap or submit_gasless_swap. This leaves the agent with insufficient context for proper use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 6 parameters. The description adds no additional meaning beyond what the schema provides, such as explaining parameter interactions or constraints. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get executable quote') and resource ('for a gasless token swap with EIP-712 signature data'), distinguishing it from sibling tools like get_swap_quote or get_gasless_price by emphasizing the gasless and executable nature with signature data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as get_swap_quote or get_gasless_price, nor does it mention prerequisites like needing a taker address or when gasless swaps are applicable. It lacks explicit usage context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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