Skip to main content
Glama

getProtocolTVL

Retrieve Total Value Locked (TVL) data for DeFi protocols including chain distribution and 24h/7d change rates using DefiLlama data.

Instructions

DeFi 프로토콜의 TVL(Total Value Locked)을 조회합니다 (DefiLlama 기반, 체인별 분포, 24h/7d 변동률)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protocolYes프로토콜 이름 (Aave, Uniswap 등) 또는 DefiLlama slug

Implementation Reference

  • The handler function that executes the logic to fetch and format protocol TVL data using the DefiLlama API.
    async function handler(args: z.infer<typeof inputSchema>): Promise<ToolResult<ProtocolTVLData>> {
      const { protocol } = args;
    
      const slug = resolveSlug(protocol);
      if (!slug) {
        return makeError(`Protocol '${protocol}' not found`, "PROTOCOL_NOT_FOUND");
      }
    
      try {
        const data = await getProtocolData(slug);
        if (!data) {
          return makeError(`Protocol '${slug}' not found on DefiLlama`, "PROTOCOL_NOT_FOUND");
        }
    
        // 체인별 TVL 분포
        const chainBreakdown: ChainTvl[] = [];
        const totalTvl = data.tvl || 0;
        for (const [chain, tvl] of Object.entries(data.chainTvls)) {
          // staking, borrowed 등 비-체인 카테고리 제외
          if (chain.includes("-") || chain === "staking" || chain === "borrowed" || chain === "pool2" || chain === "vesting") continue;
          chainBreakdown.push({
            chain,
            tvlUsd: tvl,
            percentage: totalTvl > 0 ? Math.round((tvl / totalTvl) * 10000) / 100 : 0,
          });
        }
    
        // TVL 내림차순 정렬
        chainBreakdown.sort((a, b) => b.tvlUsd - a.tvlUsd);
    
        const result: ProtocolTVLData = {
          protocol: data.name,
          slug: data.slug,
          totalTvlUsd: totalTvl,
          change24h: data.change_1d,
          change7d: data.change_7d,
          chainBreakdown,
        };
    
        return makeSuccess("ethereum", result, false);
      } catch (err) {
        const message = sanitizeError(err);
        return makeError(`Failed to fetch TVL: ${message}`, "API_ERROR");
      }
    }
  • Zod input schema defining the required 'protocol' argument.
    const inputSchema = z.object({
      protocol: z.string().describe("프로토콜 이름 (Aave, Uniswap 등) 또는 DefiLlama slug"),
    });
  • Registration function that exposes the getProtocolTVL tool to the MCP server.
    export function register(server: McpServer) {
      server.tool(
        "getProtocolTVL",
        "DeFi 프로토콜의 TVL(Total Value Locked)을 조회합니다 (DefiLlama 기반, 체인별 분포, 24h/7d 변동률)",
        inputSchema.shape,
        async (args) => {
          const result = await handler(args as z.infer<typeof inputSchema>);
          return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] };
        },
      );
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full transparency burden. It successfully discloses the data source (DefiLlama) and specific metrics included (chain distribution, 24h/7d change rates), which helps the agent understand the return data structure. It could be improved by mentioning whether data is cached/real-time or error behaviors for invalid protocols.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely compact single sentence with parenthetical elaboration. Every element earns its place: the core action, data source context, and return value details. No redundancy or wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter read-only tool, the description adequately compensates for the missing output schema by detailing what metrics are returned (TVL amount, chain breakdown, time-based changes). It appropriately scopes the tool's capability without overpromising.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% description coverage with the protocol parameter clearly documented (including examples Aave, Uniswap). The main description doesn't add parameter semantics beyond what the schema already provides, warranting the baseline score for high-coverage schemas.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action (조회합니다/retrieves), resource (DeFi protocol TVL), data source (DefiLlama), and return details (chain distribution, 24h/7d rates). It effectively distinguishes from siblings like getTokenPrice (individual tokens) and getPortfolio (user holdings) by specifying protocol-level aggregate metrics.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

While the description clearly identifies the tool's function, it does not provide explicit guidance on when to use this versus similar data-retrieval siblings like getYieldRates or getTokenHolders. Usage is implied by the specificity of 'Protocol TVL' but lacks explicit when/when-not guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/calintzy/evmscope'

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