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
| Name | Required | Description | Default |
|---|---|---|---|
| chainId | Yes | Blockchain ID where the trade was submitted | |
| tradeHash | Yes | Trade 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
- src/toolService.js:545-565 (handler)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"], }, },
- src/index.js:1150-1152 (handler)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;
- src/services/agService.js:186-204 (helper)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",