Skip to main content
Glama
kukapay

defi-yields-mcp

get_yield_pools

Retrieve DeFi yield pool data from yields.llama.fi, including symbol, project, TVL, APY, and predictions. Optionally filter results by chain or project for focused insights.

Instructions

Fetch DeFi yield pools from the yields.llama.fi API, optionally filtering by chain or project.
Returns symbol, project, tvlUsd, apy, apyMean30d, and predictions for each pool.

Args:
    chain: Optional filter for blockchain (e.g., 'Ethereum', 'Solana')
    project: Optional filter for project name (e.g., 'lido', 'aave-v3')

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNo
projectNo

Implementation Reference

  • The @mcp.tool()-decorated handler function that implements the get_yield_pools tool. Fetches data from https://yields.llama.fi/pools, extracts and filters pools by chain and project, formats the output with key fields like chain, pool (symbol), project, tvlUsd, apy, apyMean30d, predictions, and handles errors using the provided Context.
    @mcp.tool()
    async def get_yield_pools(chain: str = None, project: str = None, ctx: Context = None) -> List[Dict[str, Any]]:
        """
        Fetch DeFi yield pools from the yields.llama.fi API, optionally filtering by chain or project.
        Returns symbol, project, tvlUsd, apy, apyMean30d, and predictions for each pool.
        
        Args:
            chain: Optional filter for blockchain (e.g., 'Ethereum', 'Solana')
            project: Optional filter for project name (e.g., 'lido', 'aave-v3')
        """
        async with httpx.AsyncClient() as client:
            try:
                ctx.info("Fetching yield pools from yields.llama.fi")
                response = await client.get("https://yields.llama.fi/pools")
                response.raise_for_status()
                data = response.json()
                
                if data.get("status") != "success":
                    raise ValueError("API returned non-success status")
                
                pools = data.get("data", [])
                filtered_pools = []
                
                for pool in pools:
                    # Extract required fields
                    yield_pool = {
                        "chain": pool.get("chain", ""),
                        "pool": pool.get("symbol", ""),
                        "project": pool.get("project", ""),
                        "tvlUsd": pool.get("tvlUsd", 0.0),
                        "apy": pool.get("apy", 0.0),
                        "apyMean30d": pool.get("apyMean30d", 0.0),
                        "predictions": pool.get("predictions", {})
                    }
                    
                    # Apply filters
                    if chain and pool.get("chain", "").lower() != chain.lower():
                        continue
                    if project and yield_pool["project"].lower() != project.lower():
                        continue
                    
                    filtered_pools.append(yield_pool)
                
                ctx.info(f"Returning {len(filtered_pools)} yield pools")
                return filtered_pools
            except Exception as e:
                ctx.error(f"Error fetching yield pools: {str(e)}")
                raise
  • The @mcp.tool() decorator registers the get_yield_pools function as an MCP tool.
    @mcp.tool()
  • Function signature defines input parameters (chain, project optional strings; ctx Context) and output type (List[Dict[str, Any]]). Docstring provides detailed parameter descriptions and return info.
    async def get_yield_pools(chain: str = None, project: str = None, ctx: Context = None) -> List[Dict[str, Any]]:
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool fetches data (read operation) and returns specific fields, but lacks details on rate limits, authentication needs, error handling, or pagination. It adds basic context but misses key behavioral traits for an API call tool.

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

Conciseness4/5

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

The description is well-structured and front-loaded with the main purpose, followed by return details and parameter explanations. It uses three concise sentences with no wasted words, efficiently conveying necessary information without redundancy.

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

Completeness3/5

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

Given no annotations, no output schema, and 2 parameters, the description is moderately complete. It covers purpose, parameters, and return fields, but lacks output structure details, error cases, or advanced usage context. It's adequate for basic use but has gaps for full agent understanding.

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

Parameters4/5

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

With 0% schema description coverage, the description compensates by explaining both parameters ('chain' and 'project') with examples (e.g., 'Ethereum', 'lido'), clarifying their optional nature and usage. This adds meaningful semantics beyond the bare schema, though it doesn't cover all potential nuances like format constraints.

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

Purpose4/5

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

The description clearly states the action ('Fetch DeFi yield pools') and resource ('from the yields.llama.fi API'), with optional filtering capabilities. It distinguishes the tool's function well, though without sibling tools, differentiation isn't applicable. The purpose is specific and actionable.

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?

The description implies usage through the optional filters ('optionally filtering by chain or project'), suggesting when to apply them. However, it lacks explicit guidance on when to use this tool versus alternatives, prerequisites, or exclusions. With no sibling tools, context is limited to implied filtering scenarios.

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

Related 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/kukapay/defi-yields-mcp'

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