get_defi_protocol_endpoints
Retrieve endpoints for DeFi Protocol Analytics to access TVL data, yield farming metrics, protocol fees, and ecosystem statistics. Enables comprehensive analysis of DeFi platforms using Hive Intelligence.
Instructions
Get all endpoints in the "DeFi Protocol Analytics" category. Endpoints for comprehensive DeFi protocol analysis including Total Value Locked (TVL) data, protocol listings, chain-specific TVL metrics, historical TVL tracking across all chains, protocol fee analysis, yield farming analytics with APY data, detailed protocol information, comprehensive DeFi ecosystem statistics, blockchain network TVL tracking, yield pool management and historical charts, and protocol fee structures across different DeFi platforms.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/toolRegistry.ts:157-182 (registration)Defines the registry entry for the 'get_defi_protocol_endpoints' tool, including its category, description, and list of supported sub-tools."category": "DeFi Protocol Analytics", "name": "get_defi_protocol_endpoints", "description": "Endpoints for comprehensive DeFi protocol analysis including Total Value Locked (TVL) data, protocol listings, chain-specific TVL metrics, historical TVL tracking across all chains, protocol fee analysis, yield farming analytics with APY data, detailed protocol information, comprehensive DeFi ecosystem statistics, blockchain network TVL tracking, yield pool management and historical charts, and protocol fee structures across different DeFi platforms.", "tools": [ // "get_protocols_browser",defi // "get_protocol_tvl_browser",defi // "get_chain_tvl_browser", defi // "get_stablecoins_browser",defi // "get_stablecoin_data_browser",defi "protocol_info", "protocol_list", "global_defi_data", "defi_protocols_list", "defi_protocol_details", "protocol_tvl_current", "protocol_fees_data", "blockchain_chains_list", "chain_tvl_history", "chains_tvl_historical_all", "yield_pools_list", "yield_pool_details", "yield_pool_chart_history", "protocol_fees_overview", "chain_fees_overview", ] },
- src/dynamic-tools.ts:149-182 (handler)Dynamically creates the MCP tool 'get_defi_protocol_endpoints' (and others) from ToolRegistry. The handler retrieves the list of tools in the DeFi category, extracts their names and descriptions, and formats the response.const categoryTools = ToolRegistry.map(category => { const categorySchema = z.object({}); const categoryEndpointName = category.name; return { metadata: { resource: 'dynamic_tools', operation: 'read' as const, tags: ['category'], }, tool: { name: categoryEndpointName, description: `Get all endpoints in the "${category.category}" category. ${category.description}`, inputSchema: zodToInputSchema(categorySchema), }, handler: async ( args: Record<string, unknown> | undefined, ): Promise<any> => { const toolsInCategory = getAllToolsInCategory(category.category); return asTextContentResult({ category: category.category, description: category.description, tools: toolsInCategory.map((tool ) => ({ name: tool.name, description: tool.description })), }); }, }; }); return [getEndpointTool, callEndpointTool, ...categoryTools];
- src/toolRegistry.ts:298-314 (helper)Helper function used by the handler to filter and retrieve the full tool definitions (from supportedTools) that match the names listed in the DeFi category.export function getAllToolsInCategory(category: string){ let categoryUsed = ToolRegistry.find(tool => tool.category === category); if(!categoryUsed){ return [] } const allWrappedTools = supportedTools // return all the tools from wrapped tools that are in the category (name match) let toolsInCategory = []; for (const tool of categoryUsed.tools){ const wrappedTool = allWrappedTools.find(wrappedTool => wrappedTool.name === tool); if(wrappedTool){ toolsInCategory.push(wrappedTool); } else console.log(`Tool ${tool} not found in wrapped tools`); } return toolsInCategory; }
- src/dynamic-tools.ts:150-151 (schema)Defines the empty input schema for category listing tools like 'get_defi_protocol_endpoints' (no parameters required).const categorySchema = z.object({});
- src/dynamic-tools.ts:6-82 (helper)Helper function that formats the handler's result into MCP text content, with truncation for large responses.export function asTextContentResult(result: Object): any { // return {data: result} // Estimate token count (roughly 4 chars per token) const MAX_TOKENS = 25000; const CHARS_PER_TOKEN = 4; const maxChar = MAX_TOKENS * CHARS_PER_TOKEN; // ~100,000 chars for 25k tokens const jsonString = JSON.stringify(result, null, 2); if (jsonString.length > maxChar) { // Try to intelligently truncate if it's an array if (Array.isArray(result)) { const truncatedArray = result.slice(0, Math.floor(result.length * maxChar / jsonString.length)); const truncatedJson = JSON.stringify({ results: truncatedArray, truncated: true, originalLength: result.length, returnedLength: truncatedArray.length, message: "Response truncated due to size limits. Consider using pagination." }, null, 2); return { content: [ { type: 'text', text: truncatedJson, }, ], }; } // For objects with results array if (typeof result === 'object' && result !== null && 'results' in result && Array.isArray((result as any).results)) { const originalResults = (result as any).results; const estimatedItemSize = jsonString.length / originalResults.length; const maxItems = Math.floor(maxChar / estimatedItemSize); const truncatedResult = { ...result, results: originalResults.slice(0, maxItems), truncated: true, originalCount: originalResults.length, returnedCount: maxItems, message: "Response truncated due to size limits. Use pagination parameters (limit/offset) for more results." }; return { content: [ { type: 'text', text: JSON.stringify(truncatedResult, null, 2), }, ], }; } // Fallback to simple truncation const truncated = jsonString.substring(0, maxChar) + '\n... [TRUNCATED DUE TO SIZE LIMITS]'; return { content: [ { type: 'text', text: truncated, }, ], }; } return { content: [ { type: 'text', text: jsonString, }, ], }; }