get_liquidity_sources
Retrieve available liquidity sources for a specific blockchain to identify trading opportunities and execute DeFi transactions.
Instructions
Get list of liquidity sources available on a specific chain
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainId | Yes | Blockchain ID to get sources for |
Implementation Reference
- src/index.js:181-194 (schema)MCP tool schema definition including name, description, and input schema requiring chainId.
{ name: TOOL_NAMES.GET_LIQUIDITY_SOURCES, description: "Get list of liquidity sources available on a specific chain", inputSchema: { type: "object", properties: { chainId: { type: "integer", description: "Blockchain ID to get sources for", }, }, required: ["chainId"], }, - src/index.js:1000-1002 (registration)Registration and dispatch in the MCP CallToolRequestHandler switch statement.
case TOOL_NAMES.GET_LIQUIDITY_SOURCES: result = await toolService.getLiquiditySources(args.chainId); break; - src/toolService.js:121-133 (handler)ToolService handler that validates chainId, delegates to AgService.getLiquiditySources, and wraps the response with metadata.
async getLiquiditySources(chainId) { if (!chainId) { throw new Error("chainId is required"); } const result = await this.agg.getLiquiditySources(chainId); return { message: `Liquidity sources for chain ${chainId} retrieved successfully`, data: result, summary: `Found ${result.sources?.length || 0} liquidity sources`, }; } - src/services/agService.js:97-115 (handler)Core AgService handler implementing the HTTP fetch to the aggregator API endpoint /api/swap/sources.
async getLiquiditySources(chainId) { try { const response = await fetch(`${this.baseUrl}/api/swap/sources?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 || 'API request failed'); } return data.data; } catch (error) { throw new Error(`Failed to get liquidity sources: ${error.message}`); } } - src/constants.js:8-8 (helper)Constant definition of the tool name used throughout the codebase.
GET_LIQUIDITY_SOURCES: "get_liquidity_sources",