Tools Reference
The DeFiStream MCP server exposes 12 tools — 5 protocol query builders and 7 utility tools.
Typical workflow
An agent will usually follow this pattern:
- Discover — Call
supported_networksorsupported_eventsto verify a protocol/network combination is valid - Build — Use a query builder to construct the query path
- Check cost (optional) — Call
calculate_costto preview the block cost before executing - Execute — Pass the query path to
execute_query(for inline CSV results) ordownload_query_as_link(for CSV/Parquet download links)
Query Builders
Each builder returns a query path string. Pass it to execute_query or download_query_as_link to get results.
erc20_query_builder
Build queries for ERC-20 token events (USDT, USDC, WETH, DAI, etc.).
| Parameter | Type | Required | Description |
|---|---|---|---|
event_type | string | Yes | Event type (e.g. "transfer") |
network | string | Yes | Network identifier (e.g. "ETH", "ARB", "BASE") |
token | string | Yes | Token symbol, comma-separated symbols, or contract address |
decimals | int | No | Token decimals (required when using a custom contract address) |
sender | string | No | Filter by sender address (comma-separated for multiple) |
receiver | string | No | Filter by receiver address (comma-separated for multiple) |
involving | string | No | Filter by any involved address |
min_amount | number | No | Minimum transfer amount |
max_amount | number | No | Maximum transfer amount |
Plus all common parameters.
native_token_query_builder
Build queries for native blockchain token transfers (ETH, MATIC, BNB, etc.).
| Parameter | Type | Required | Description |
|---|---|---|---|
event_type | string | Yes | Event type (e.g. "transfer") |
network | string | Yes | Network identifier |
sender | string | No | Filter by sender address |
receiver | string | No | Filter by receiver address |
involving | string | No | Filter by any involved address |
min_amount | number | No | Minimum transfer amount |
max_amount | number | No | Maximum transfer amount |
Plus all common parameters.
aave_query_builder
Build queries for AAVE V3 lending protocol events.
| Parameter | Type | Required | Description |
|---|---|---|---|
event_type | string | Yes | "deposit", "withdraw", "borrow", "repay", "flashloan", or "liquidation" |
network | string | Yes | Network identifier |
eth_market_type | string | No | AAVE market type on ETH: "Core", "Prime", or "EtherFi" |
involving | string | No | Filter by any involved address |
Plus all common parameters.
uniswap_query_builder
Build queries for Uniswap V3 DEX events.
| Parameter | Type | Required | Description |
|---|---|---|---|
event_type | string | Yes | "swap", "deposit", "withdraw", or "collect" |
network | string | Yes | Network identifier |
symbol0 | string | Yes | First token symbol in the pool (e.g. "WETH") |
symbol1 | string | Yes | Second token symbol in the pool (e.g. "USDC") |
fee | int | Yes | Pool fee tier: 100, 500, 3000, or 10000 |
involving | string | No | Filter by any involved address |
Plus all common parameters.
lido_query_builder
Build queries for Lido liquid staking events.
| Parameter | Type | Required | Description |
|---|---|---|---|
event_type | string | Yes | "deposit", "withdrawal_request", "withdrawal_claimed", "l2_deposit", or "l2_withdrawal_request" |
network | string | Yes | Network identifier (e.g. "ETH", "ARB", "BASE", "OP") |
involving | string | No | Filter by any involved address |
Plus all common parameters.
Common Parameters
These parameters are shared across all query builders:
| Parameter | Type | Default | Description |
|---|---|---|---|
block_start | int | — | Starting block number |
block_end | int | — | Ending block number |
since | string | — | Start time (ISO 8601 or Unix timestamp) |
until | string | — | End time (ISO 8601 or Unix timestamp) |
verbose | bool | false | Include all metadata fields (tx_hash, log_index, etc.) |
with_value | bool | false | Enrich events with USD value data |
aggregate | bool | false | Return aggregated results instead of raw events |
group_by | string | "time" | Bucket grouping — "time" or "block_number" (aggregate only) |
period | string | "1h" | Bucket size, e.g. "1h", "1d", "30m" for time; "1000" for blocks (aggregate only) |
involving_label | string | — | Filter by entity label substring (e.g. "Binance") |
involving_category | string | — | Filter by address category (e.g. "exchange") |
sender_label | string | — | Filter sender by label |
sender_category | string | — | Filter sender by category |
receiver_label | string | — | Filter receiver by label |
receiver_category | string | — | Filter receiver by category |
Note: Use either block ranges (
block_start/block_end) or time ranges (since/until), not both.
Utility Tools
supported_networks
Get the list of supported blockchain networks for a protocol.
supported_networks(protocol: string) protocol values: erc20, native_token, aave, uniswap, lido
supported_events
Get the list of supported event types for a protocol.
supported_events(protocol: string) base_url
Get the DeFiStream API base URL. Combine with a query path from any builder to form the full API URL.
base_url() execute_query
Execute a query and return CSV results directly. Best for small to medium result sets.
execute_query(query: string, api_key: string) | Parameter | Type | Default | Description |
|---|---|---|---|
query | string | — | Query path from a query builder |
api_key | string | — | Your DeFiStream API key |
calculate_cost
Calculate the cost of a query before executing it (dry-run). Returns the block cost, your remaining quota, and a breakdown. Does not deduct from your quota.
calculate_cost(query: string, api_key: string) | Parameter | Type | Default | Description |
|---|---|---|---|
query | string | — | Query path from a query builder |
api_key | string | — | Your DeFiStream API key |
download_query_as_link
Get a shareable download link for query results. Supports unlimited block ranges. Links expire in 1 hour.
download_query_as_link(query: string, api_key: string, file_format?: string) | Parameter | Type | Default | Description |
|---|---|---|---|
query | string | — | Query path from a query builder |
api_key | string | — | Your DeFiStream API key |
file_format | string | "csv" | Output format: "csv" or "parquet" |
query_local_execution_guide
Get code snippets for executing a query locally (curl, Python, JavaScript, and the Python client library).
query_local_execution_guide(query: string)