execute
Run async JavaScript code with a pre-wired DefiLlama client to query protocols, DEX volumes, yields, prices, and more. Returns JSON output and console logs.
Instructions
Run async JavaScript against a pre-wired DefiLlama client. Define async function run(defillama) { ... }; the JSON-serializable return value is sent back plus console.log output. The defillama client mirrors the services: defillama.protocol, defillama.dex, defillama.fees, defillama.options, defillama.stablecoin, defillama.price, defillama.yield, defillama.blockchain, plus defillama.resolveChain / defillama.resolveProtocol / defillama.resolveStablecoin helpers. JavaScript only (no type annotations); variables don't persist between calls; no fs, no network outside the client.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "execute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| intent | No |