get_yield_pools
Retrieve comprehensive yield pool data with predictions to analyze DeFi investment opportunities.
Instructions
GET /yields/pools
Retrieve the latest data for all pools, including enriched information such as predictions.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_yield_pools"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- defillama_server.py:442-449 (handler)The handler function for the 'get_yield_pools' MCP tool. Decorated with @mcp.tool() for registration, it fetches the latest yield pools data from the DefiLlama API endpoint '/yields/pools' and returns it as a string.
@mcp.tool() async def get_yield_pools() -> str: """GET /yields/pools Retrieve the latest data for all pools, including enriched information such as predictions. """ result = await make_request('GET', '/yields/pools') return str(result) - defillama_server.py:30-38 (helper)Helper function used by get_yield_pools and other tools to perform HTTP requests to the DefiLlama API.
async def make_request(method: str, endpoint: str, params: Optional[Dict[str, Any]] = None) -> Any: """Make a request to the DefiLlama API.""" try: response = await client.request(method, endpoint, params=params) response.raise_for_status() return response.json() except Exception as e: return f"Error: {str(e)}" - defillama_server.py:12-12 (registration)Initialization of the FastMCP server instance where tools like get_yield_pools are registered via decorators.
mcp = FastMCP("defillama") - defillama_server.py:892-893 (registration)Entry point that runs the MCP server, making all registered tools available.
if __name__ == "__main__": mcp.run(transport='stdio')