Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_gasless_approval_tokens

Retrieve tokens supporting gasless approvals via EIP-2612 permit to reduce transaction costs and streamline DeFi interactions on supported blockchains.

Instructions

Get list of tokens that support gasless approvals (EIP-2612 permit)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainIdNoBlockchain ID (e.g., 8453 for Base, defaults to 8453 if not provided)

Implementation Reference

  • Main handler function for the 'get_gasless_approval_tokens' MCP tool. Extracts chainId (defaults to Base 8453), delegates to AgService, wraps response with metadata.
    async getGaslessApprovalTokens(params = {}) {
      // Default to Base chain if no chainId provided
      const chainId = params.chainId || 8453;
    
      const result = await this.agg.getGaslessApprovalTokens(chainId);
    
      return {
        message: "Gasless approval tokens retrieved successfully",
        data: result,
        summary: `Found ${
          result.tokens?.length || 0
        } tokens supporting gasless approvals on chain ${chainId}`,
        note: "These tokens support EIP-2612 permit or meta-transaction approvals",
        chainId,
      };
    }
  • MCP tool schema definition including inputSchema for 'get_gasless_approval_tokens' in the ListToolsRequestHandler.
    name: TOOL_NAMES.GET_GASLESS_APPROVAL_TOKENS,
    description:
      "Get list of tokens that support gasless approvals (EIP-2612 permit)",
    inputSchema: {
      type: "object",
      properties: {
        chainId: {
          type: "integer",
          description:
            "Blockchain ID (e.g., 8453 for Base, defaults to 8453 if not provided)",
        },
      },
      required: [],
    },
  • src/index.js:1158-1160 (registration)
    Tool dispatch/registration in the CallToolRequestHandler switch statement, mapping tool name to handler.
    case TOOL_NAMES.GET_GASLESS_APPROVAL_TOKENS:
      result = await toolService.getGaslessApprovalTokens(args);
      break;
  • Helper service method in AgService that makes the actual API call to retrieve gasless approval tokens.
    async getGaslessApprovalTokens(chainId) {
      try {
        const response = await fetch(`${this.baseUrl}/api/swap/gasless/approval-tokens?chainId=${chainId}`);
        
        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 approval tokens request failed');
        }
        
        return data.data;
      } catch (error) {
        throw new Error(`Failed to get gasless approval tokens: ${error.message}`);
      }
    }
  • src/constants.js:16-16 (registration)
    Constant definition for the tool name used throughout the codebase.
    GET_GASLESS_APPROVAL_TOKENS: "get_gasless_approval_tokens",

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