Skip to main content
Glama

DeFi Trading Agent MCP Server

by edkdev

get_gasless_status

Check the status of a gasless swap transaction by providing the trade hash and blockchain ID. Used within the DeFi Trading Agent MCP Server for monitoring autonomous crypto trades.

Instructions

Get the status of a submitted gasless swap

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "chainId": { "description": "Blockchain ID where the trade was submitted", "type": "integer" }, "tradeHash": { "description": "Trade hash from gasless swap submission", "type": "string" } }, "required": [ "tradeHash", "chainId" ], "type": "object" }

Implementation Reference

  • The main MCP tool handler for get_gasless_status. Validates parameters (tradeHash, chainId), calls the AgService helper, and returns formatted response with status summary.
    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, }, }; }
  • src/index.js:726-742 (registration)
    MCP tool registration in the ListTools handler, including name, description, and input schema validation.
    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"], }, },
  • Dispatch handler in the CallToolRequest switch statement that routes the tool call 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 to fetch the gasless swap status.
    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}`); } }
  • src/constants.js:14-14 (registration)
    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