Skip to main content
Glama

kilolend_get_lending_markets

Retrieve current lending markets on KiloLend with rates and statistics for DeFi analysis on the KAIA blockchain.

Instructions

Get all lending markets KiloLend with their current rates and statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'kilolend_get_lending_markets' tool, which fetches market data from the agent and returns a structured response with market statistics.
    handler: async (agent: WalletAgent, input: Record<string, any>) => {
        try {
            // Use the getAllMarkets method which already fetches all market data
            const markets = await agent.getAllMarkets();
    
            return {
                status: "success",
                message: `✅ Retrieved ${markets.length} lending markets`,
                network: "kaia",
                markets: markets,
                summary: {
                    total_markets: markets.length,
                    avg_supply_apy: (markets.reduce((sum, m) => sum + parseFloat(m.supplyApy), 0) / markets.length).toFixed(2),
                    avg_borrow_apy: (markets.reduce((sum, m) => sum + parseFloat(m.borrowApy), 0) / markets.length).toFixed(2),
                    highest_supply_apy: markets.reduce((max, m) => parseFloat(m.supplyApy) > parseFloat(max.supplyApy) ? m : max, markets[0])?.symbol || 'N/A',
                    highest_borrow_apy: markets.reduce((max, m) => parseFloat(m.borrowApy) > parseFloat(max.borrowApy) ? m : max, markets[0])?.symbol || 'N/A'
                },
                recommendations: [
                    "Compare supply and borrow rates across markets",
                    "Check utilization rates - high utilization may indicate increasing rates",
                    "Consider market depth (total supply) for larger positions",
                    "Monitor rates regularly as they change with market conditions"
                ]
            };
        } catch (error: any) {
            throw new Error(`Failed to get markets: ${error.message}`);
        }
    }
  • The registration definition of the 'kilolend_get_lending_markets' tool, including its name, description, schema, and handler.
    export const GetMarketsTool: McpTool = {
        name: "kilolend_get_lending_markets",
        description: "Get all lending markets KiloLend with their current rates and statistics",
        schema: {},
        handler: async (agent: WalletAgent, input: Record<string, any>) => {
            try {
                // Use the getAllMarkets method which already fetches all market data
                const markets = await agent.getAllMarkets();
    
                return {
                    status: "success",
                    message: `✅ Retrieved ${markets.length} lending markets`,
                    network: "kaia",
                    markets: markets,
                    summary: {
                        total_markets: markets.length,
                        avg_supply_apy: (markets.reduce((sum, m) => sum + parseFloat(m.supplyApy), 0) / markets.length).toFixed(2),
                        avg_borrow_apy: (markets.reduce((sum, m) => sum + parseFloat(m.borrowApy), 0) / markets.length).toFixed(2),
                        highest_supply_apy: markets.reduce((max, m) => parseFloat(m.supplyApy) > parseFloat(max.supplyApy) ? m : max, markets[0])?.symbol || 'N/A',
                        highest_borrow_apy: markets.reduce((max, m) => parseFloat(m.borrowApy) > parseFloat(max.borrowApy) ? m : max, markets[0])?.symbol || 'N/A'
                    },
                    recommendations: [
                        "Compare supply and borrow rates across markets",
                        "Check utilization rates - high utilization may indicate increasing rates",
                        "Consider market depth (total supply) for larger positions",
                        "Monitor rates regularly as they change with market conditions"
                    ]
                };
            } catch (error: any) {
                throw new Error(`Failed to get markets: ${error.message}`);
            }
        }
    };

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/tamago-labs/kaia-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server