Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

get_gasless_status

Check the status of a submitted gasless swap transaction by providing the trade hash and blockchain ID to monitor execution progress.

Instructions

Get the status of a submitted gasless swap

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tradeHashYesTrade hash from gasless swap submission
chainIdYesBlockchain ID where the trade was submitted

Implementation Reference

  • Main handler function for the get_gasless_status tool. Validates input parameters (tradeHash, chainId), calls the AgService to fetch status, and formats the response with additional metadata for the MCP protocol.
    async getGaslessStatus(params) {
      const { tradeHash, chainId } = params;
    
      if (!tradeHash || !chainId) {
        throw new Error("Missing required parameters: tradeHash, chainId");
      }
    
      const result = await this.agg.getGaslessStatus(tradeHash, chainId);
    
      return {
        message: `Gasless swap status for ${tradeHash} retrieved successfully`,
        data: result,
        summary: `Status: ${result.status || "unknown"}`,
        gaslessInfo: {
          tradeHash,
          chainId,
          isGasless: true,
          relayerManaged: true,
        },
      };
    }
  • Input schema and description for the get_gasless_status tool, registered in the ListToolsRequestHandler response.
      name: TOOL_NAMES.GET_GASLESS_STATUS,
      description: "Get the status of a submitted gasless swap",
      inputSchema: {
        type: "object",
        properties: {
          tradeHash: {
            type: "string",
            description: "Trade hash from gasless swap submission",
          },
          chainId: {
            type: "integer",
            description: "Blockchain ID where the trade was submitted",
          },
        },
        required: ["tradeHash", "chainId"],
      },
    },
  • src/index.js:1150-1152 (registration)
    Dispatch/registration in the CallToolRequestHandler switch statement that routes calls to toolService.getGaslessStatus.
    case TOOL_NAMES.GET_GASLESS_STATUS:
      result = await toolService.getGaslessStatus(args);
      break;
  • Core helper function in AgService that makes the HTTP request to the aggregator API endpoint /api/swap/gasless/status/{tradeHash} to retrieve the actual status data.
    async getGaslessStatus(tradeHash, chainId) {
      try {
        const response = await fetch(`${this.baseUrl}/api/swap/gasless/status/${tradeHash}?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 status request failed');
        }
        
        return data.data;
      } catch (error) {
        throw new Error(`Failed to get gasless status: ${error.message}`);
      }
    }
  • Constant definition for the tool name used throughout the codebase.
    GET_GASLESS_STATUS: "get_gasless_status",

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