get_gasless_approval_tokens
Retrieve tokens supporting gasless approvals via EIP-2612 permit for efficient DeFi transactions. Specify blockchain ID to filter results and streamline trading operations.
Instructions
Get list of tokens that support gasless approvals (EIP-2612 permit)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainId | No | Blockchain ID (e.g., 8453 for Base, defaults to 8453 if not provided) |
Input Schema (JSON Schema)
{
"properties": {
"chainId": {
"description": "Blockchain ID (e.g., 8453 for Base, defaults to 8453 if not provided)",
"type": "integer"
}
},
"required": [],
"type": "object"
}
Implementation Reference
- src/toolService.js:580-595 (handler)Main handler function for the get_gasless_approval_tokens tool. Validates params, defaults chainId to Base (8453), calls AgService, and formats response.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, }; }
- src/index.js:754-768 (schema)MCP tool schema definition including name, description, and input schema (optional chainId).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 main switch case handler for CallToolRequest.case TOOL_NAMES.GET_GASLESS_APPROVAL_TOKENS: result = await toolService.getGaslessApprovalTokens(args); break;
- src/services/agService.js:226-244 (helper)Core API call implementation in AgService that fetches approval tokens from the aggregator API endpoint.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)Tool name constant definition used in registration and dispatch.GET_GASLESS_APPROVAL_TOKENS: "get_gasless_approval_tokens",