Finance5 min readBy Purrkey team

How to check a protocol's current TVL on DefiLlama

Fetch one protocol's current total value locked in USD by its DefiLlama slug, then fill a twelve-row comparison table for a weekly risk review

On this page

You have 12 DeFi protocols on a shortlist and need each one's current total value locked in USD before a weekly risk review. That is 12 calls, one per slug, feeding a single comparison table that decides which protocols get watched more closely

The table is the deliverable: the slug you looked up, the value the tool returns, and a readable protocol name beside it. Nothing here has been run, so the rows below show the shape of the output rather than real figures

Set up the comparison table first

Three columns carry the review

protocol_nameslugtvlUsd
(your label)(from DefiLlama)(number, USD)

Values here are placeholders showing the shape. tvlUsd is the field the tool fills. The risk review reads down that column, so keep the raw number and do the formatting later if the table has to go into a deck

Twelve rows fit on one screen, which is the point of the design: the review compares protocols against each other rather than reading twelve separate pages

Pass one slug per call

defillama.protocol.tvl takes one required field, slug, which you read off the protocol's DefiLlama URL or page and pass as a string

slug
uniswap

Example only

The limit sits on this step: one slug per call, so twelve protocols means twelve calls, and the slug string is capped at 64 characters and must match ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$. A string with a space, a slash or a hyphen at the start does not match that pattern, so clean what you copied before the call. The price rule reads "failed executions are not charged", which matters when a malformed slug is rejected and you correct it and run again. The other risk is quieter: a slug that matches the pattern but names a different protocol will return that protocol's number, and the table will look fine. Check each slug against the page title before the rows fill

Read the two output fields

The output schema has two properties, slug and tvlUsd, and both are required. slug echoes the string you sent, which is your join key back to the row. tvlUsd is a number in US dollars, and it is the value the decision column reads

The schema lists no timestamp and no per-chain split. The response cannot tell you when the figure was taken or how it divides across chains, so add a run date column to the table if the review compares one week against the next. Treat a returned slug that differs from the one you typed as a broken row and fix it before sorting

The sorting step is mechanical: order the twelve rows by tvlUsd and the top and bottom of the list become the candidates for closer monitoring. What counts as a change worth acting on is your review's call, not something the response supplies

The agent prompt

Agent prompt
Set up https://purrkey.app/SKILL.md, then use Purrkey to fetch the current total value locked in USD for each protocol slug on my shortlist, one call per slug, no batching. Check the current inputs and price of defillama.protocol.tvl before running anything. My slugs (example values, replace with your own): uniswap, aave, curve-dex. Return a table with protocol_name, slug, tvlUsd and run date. Leave tvlUsd empty for any slug that fails and do not estimate a value.

The prompt names the tool id so the agent reads the live contract and price rather than a copy of them. Twelve slugs is the full weekly run; try a single slug first and confirm the returned slug matches the one you sent

Estimated tool cost

Catalog read on November 17, 2026: defillama.protocol.tvl at $0.0005 per call, listed against POST /v1/runs. The rule text reads "Fixed per-call price under the published tool contract; failed executions are not charged". Totals below are ceilings for the listed calls

StepFormulaUnit pricePlanned quantityTotal
One protocol checkcalls x price$0.0005 per call1$0.0005
Twelve-protocol shortlistcalls x price$0.0005 per call12$0.006
Weekly review, 12 protocolscalls x price$0.0005 per call12$0.006

Model fees for the agent are not counted here. A longer shortlist scales linearly at $0.0005 per call, so 50 protocols would be at most $0.025

Start with one protocol

Open the tool page at DefiLlama TVL on Purrkey and send a single slug before you commit the shortlist. Check that the returned slug matches the one you typed and that tvlUsd arrived as a number, then fill the other eleven rows

Get started by giving this to your agent

  • Claude Code
  • Codex
  • Gemini CLI
  • Cursor
  • GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with DefiLlama.
Explore DefiLlama tools and pricing

FAQ

How do I check a protocol's TVL on DefiLlama by slug?

Call defillama.protocol.tvl with the protocol's DefiLlama slug, one call per protocol. The slug comes from the protocol's DefiLlama URL or page.

What input does defillama.protocol.tvl take?

One required field, slug. The slug is capped at 64 characters and must match ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$.

What does the tool return?

Two required fields, slug and tvlUsd. The slug echoes the string you sent and tvlUsd is a number in US dollars. The schema lists no timestamp and no per-chain breakdown.

How much does it cost to check 12 protocols?

Twelve calls at $0.0005 per call, at most $0.006. The rule text says failed executions are not charged, and agent model fees are not counted.

Can I check several protocols in one call?

No. One slug per call, so a twelve-protocol shortlist is twelve calls.

Why was my slug rejected?

The slug pattern allows letters, digits, dots, underscores and hyphens, and it cannot start with a punctuation mark. A string with a space, a slash or a leading hyphen does not match, so clean it before the call.

Does the tool return historical TVL or a chain-level split?

No. The output schema carries slug and tvlUsd and nothing else, so the response cannot supply a history or a breakdown across chains.

Next step

Try this with DefiLlama

The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.

See DefiLlama tools

Share this article