tapp_get_pools
Retrieve a paginated list of pools on Tapp Exchange, filtered by type or sorted by TVL, to manage and analyze decentralized exchange liquidity.
Instructions
Get a paginated list of available pools on Tapp Exchange, optionally filtered by type and sorted by TVL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | The page number to fetch (defaults to 1) | |
| size | No | Number of items per page (defaults to 10) | |
| sortBy | No | Field to sort by (defaults to 'tvl') | |
| type | No | Pool type filter: 'AMM', 'CLMM', or 'STABLE' |
Implementation Reference
- src/mcp/tapp/pool-tools.ts:14-25 (handler)The MCP tool handler for 'tapp_get_pools'. It invokes TappAgent.getPools with input params and formats the response with status, pools data, and pagination metadata.handler: async (agent: TappAgent, input: Record<string, any>) => { const pools = await agent.getPools(input); return { status: "success", pools, pagination: { page: input.page || 1, size: input.size || 10, total: pools.length } }; },
- src/mcp/tapp/pool-tools.ts:8-13 (schema)Zod-based input schema defining optional parameters: page, size, sortBy, and type for filtering and paginating pools.schema: { page: z.number().optional().describe("The page number to fetch (defaults to 1)"), size: z.number().optional().describe("Number of items per page (defaults to 10)"), sortBy: z.string().optional().describe("Field to sort by (defaults to 'tvl')"), type: z.string().optional().describe("Pool type filter: 'AMM', 'CLMM', or 'STABLE'") },
- src/mcp/index.ts:25-58 (registration)Aggregation object TappExchangeMcpTools that includes the GetPoolsTool (named 'tapp_get_pools' internally), imported and used for MCP server registration.export const TappExchangeMcpTools = { // Pool Management Tools "GetPoolsTool": GetPoolsTool, "GetPoolInfoTool": GetPoolInfoTool, // Swap Tools "GetSwapEstimateTool": GetSwapEstimateTool, "GetSwapRouteTool": GetSwapRouteTool, "SwapAMMTool": SwapAMMTool, "SwapCLMMTool": SwapCLMMTool, "SwapStableTool": SwapStableTool, // Pool Creation and Initial Liquidity Tools "CreateAMMPoolAndAddLiquidityTool": CreateAMMPoolAndAddLiquidityTool, "CreateCLMMPoolAndAddLiquidityTool": CreateCLMMPoolAndAddLiquidityTool, "CreateStablePoolAndAddLiquidityTool": CreateStablePoolAndAddLiquidityTool, // Add Liquidity Tools "AddAMMLiquidityTool": AddAMMLiquidityTool, "AddCLMMLiquidityTool": AddCLMMLiquidityTool, "AddStableLiquidityTool": AddStableLiquidityTool, // Remove Liquidity Tools "RemoveSingleAMMLiquidityTool": RemoveSingleAMMLiquidityTool, "RemoveMultipleAMMLiquidityTool": RemoveMultipleAMMLiquidityTool, "RemoveSingleCLMMLiquidityTool": RemoveSingleCLMMLiquidityTool, "RemoveMultipleCLMMLiquidityTool": RemoveMultipleCLMMLiquidityTool, "RemoveSingleStableLiquidityTool": RemoveSingleStableLiquidityTool, "RemoveMultipleStableLiquidityTool": RemoveMultipleStableLiquidityTool, // Position Management Tools "GetPositionsTool": GetPositionsTool, "CollectFeeTool": CollectFeeTool };
- src/index.ts:20-52 (registration)Dynamic registration of all tools from TappExchangeMcpTools to the MCP server using server.tool(), passing name, description, schema, and wrapped handler.for (const [_key, tool] of Object.entries(TappExchangeMcpTools)) { server.tool(tool.name, tool.description, tool.schema, async (params: any): Promise<any> => { try { // Execute the handler with the params directly const result = await tool.handler(agent, params); // Format the result as MCP tool response return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { console.error("error", error); // Handle errors in MCP format return { isError: true, content: [ { type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }, ], }; } }) }
- src/agent/index.ts:220-228 (helper)TappAgent.getPools method delegated to by the tool handler, which calls the external TappSDK's Pool.getPools implementation.async getPools(params: { page?: number; size?: number; sortBy?: string; type?: string; }): Promise<TappPool[]> { const pools = await this.sdk.Pool.getPools(params as any); return pools; }