Skip to main content
Glama
edkdev

DeFi Trading Agent MCP Server

by edkdev

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
NameRequiredDescriptionDefault
chainIdYesBlockchain ID to get sources for

Implementation Reference

  • 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;
  • 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`, }; }
  • 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}`); } }
  • Constant definition of the tool name used throughout the codebase.
    GET_LIQUIDITY_SOURCES: "get_liquidity_sources",

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