Defillama official defi data

From jiayaoqijia/cryptoskill · View interactive version

Defillama official defi data is an AI agent skill from the GitHub repository jiayaoqijia/cryptoskill. Core reference for DefiLlama MCP tools. Maps DeFi questions to the correct tool call with proper parameters. Covers entity conventions, metric interpretation, stock vs flow distinctions, percentage formatting, and error recovery. Use whenever querying DeFi data — protocol TVL, token prices, chain me

How to use this skill

Skill file

DefiLlama MCP Data Reference

Tool Quick Reference

| Question | Tool | Key Params |

|----------|------|------------|

| Total DeFi TVL, global volumes | defillama:get_market_totals | metrics (tvl_base, volume_dexs_1d, etc.) |

| Protocol TVL, fees, revenue | defillama:get_protocol_metrics | protocol, metrics |

| Chain TVL, gas fees, REV | defillama:get_chain_metrics | chain, metrics |

| Token price, mcap, ATH | defillama:get_token_prices | token |

| Category rankings | defillama:get_category_metrics | category |

| Pool APY, lending rates | defillama:get_yield_pools | token, chain, category |

| Stablecoin supply | defillama:get_stablecoin_supply | stablecoin, chain |

| ETF inflows/outflows | defillama:get_etf_flows | token (bitcoin/ethereum) |

| Bridge volume | defillama:get_bridge_flows | bridge, chain |

| CEX volume | defillama:get_cex_volumes | cex |

| Open interest | defillama:get_open_interest | protocol, chain |

| Hacks/exploits | defillama:get_events | event_type: "hacks" |

| Fundraising | defillama:get_events | event_type: "raises" |

| Protocol events | defillama:get_events | event_type: "protocol_events" |

| Protocol treasury | defillama:get_treasury | treasury |

| Institutional holdings | defillama:get_dat_holdings | institution, token |

| Token unlocks | defillama:get_token_unlocks | token, query_type (chart, window, day, window_all, ratio, market_window) |

| Token TVL in protocols | defillama:get_token_tvl | token, protocol |

| Oracle coverage | defillama:get_oracle_metrics | oracle |

| User activity | defillama:get_user_activity | protocol, chain |

| Income statement | defillama:get_income_statement | protocol |

| Protocol metadata, URLs, audit | defillama:get_protocol_info | protocol, category, tag, has_token, chain |

| Chain metadata, type, L2 parent | defillama:get_chain_info | chain, chain_type |

| List valid categories | defillama:list_categories | type (protocol, token, chain) |

| Unknown entity slug | defillama:resolve_entity | name |

Entity Conventions

Protocol vs Sub-Protocol

Many protocols have multiple versions. The database tracks both:

resolve_entity returns both slug (sub-protocol) and parent_protocol. Use parent_protocol for get_protocol_metrics. Use slug when you need a specific version.

Example: resolve_entity({name: "compound"}) returns:

→ Use protocol: "compound" in get_protocol_metrics for the aggregate.

Array Support

All entity params accept single values or arrays for comparison:

Entity Resolution

Try tools directly for well-known entities — works 80%+ of the time. Use defillama:resolve_entity only when:

Period Parameter

All tools accept period (NOT time_range):

For custom date ranges, use start_date and end_date (YYYY-MM-DD format) instead of period. If start_date is set without end_date, it defaults to today.

Critical Conventions

Stock vs Flow

Different aggregation rules -- getting this wrong produces nonsensical results:

Percentage Formatting

Two different conventions in the data:

TVL Components

Components are mutually exclusive -- never double-add:

Fee and Revenue

Metric Name Patterns

Protocol metrics follow these patterns:

Chain metrics use chain_fees, chain_revenue, chain_mev, app_fees, app_revenue instead of fees, revenue.

Daily views only have the _1d suffix for flows/volumes.

Important Gotchas

Examples

Example 1:

User: "What is Aave's TVL?"

Tool call: defillama:get_protocol_metrics(protocol: "aave", metrics: ["tvl_base"])

Example 2:

User: "Top 5 chains by fees"

Tool call: defillama:get_chain_metrics(sort_by: "chain_fees_1d desc", limit: 5)

Example 3:

User: "ETH price history over 90 days"

Tool call: defillama:get_token_prices(token: "coingecko:ethereum", period: "90d")

Example 4:

User: "Compare ETH price and Ethereum chain TVL"

Tool calls in parallel:

Example 5:

User: "Biggest DeFi hacks this year"

Tool call: defillama:get_events(event_type: "hacks", sort_by: "amount desc", limit: 10, period: "365d")

Example 6:

User: "Aave TVL from Jan to Mar 2025"

Tool call: defillama:get_protocol_metrics(protocol: "aave", metrics: ["tvl_base"], start_date: "2025-01-01", end_date: "2025-03-31")

Error Recovery

  1. 0 rows returned -> call defillama:resolve_entity(name: "...") -> retry with the correct slug
  2. Wrong data -> verify you're using the right tool (protocol vs chain vs category)
  3. Ambiguous entity -> call resolve_entity to see all matching slugs, then pick the right one
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.