When you can't use MCP: rolling your own tool loop
MCP is the cleanest way to give an AI agent crypto data, but it is not always available. If you are calling the OpenAI or Anthropic API directly — inside a backend, a serverless function, a custom agent framework — you need to define tools yourself with function-calling schemas.
The pattern is the same across providers: you describe each tool as a JSON schema, the model decides which to call and with what arguments, your code executes the call, and you feed the result back. The only thing that differs is the exact shape of the schema.
Below are ready-to-paste tool definitions for the core CryptoDataAPI endpoints, in both formats, plus the single handler that runs them. Copy them straight into your agent.
Tool schema for OpenAI function calling
OpenAI's tools array takes one object per function. Here are two of the most useful CryptoDataAPI tools — a full market snapshot and a single-coin lookup:
tools = [
{
"type": "function",
"function": {
"name": "get_daily_snapshot",
"description": "Complete crypto market overview: prices, market health score, derivatives positioning, sentiment, and macro. Call this first for any broad market question.",
"parameters": {"type": "object", "properties": {}}
}
},
{
"type": "function",
"function": {
"name": "get_coin_profile",
"description": "Detailed profile for one coin: price, market cap, and 24h/7d changes.",
"parameters": {
"type": "object",
"properties": {
"symbol": {"type": "string", "description": "Ticker, e.g. BTC or ETH"}
},
"required": ["symbol"]
}
}
}
]The description field is doing real work: it tells the model when to reach for each tool. Spell out the trigger (“call this first for any broad market question”) rather than just naming the endpoint.
The same tools in Anthropic tool-use format
Anthropic's Claude models use a slightly different envelope — input_schema instead of nested parameters — but the fields map one-to-one:
tools = [
{
"name": "get_daily_snapshot",
"description": "Complete crypto market overview: prices, health score, derivatives, sentiment, macro. Call first for broad market questions.",
"input_schema": {"type": "object", "properties": {}}
},
{
"name": "get_funding_rates",
"description": "Cross-exchange perpetual funding rates. Positive funding means longs pay shorts (bullish crowding); negative means shorts pay longs.",
"input_schema": {"type": "object", "properties": {}}
}
]Notice the interpretive hint baked into the funding-rate description. Claude reasons better when the tool tells it what the numbers mean, not just what they are — so it does not have to guess whether positive funding is bullish or bearish.
MCP vs raw function calling vs Custom GPT
Three ways to give an agent these tools, by how much you control the loop:
| Raw function calling | MCP server | Custom GPT Actions | |
|---|---|---|---|
| You write the loop | Yes | No | No |
| Tool schemas by hand | Yes (this article) | No — auto-exposed | No — from OpenAPI |
| Runs in your backend | Yes | Local subprocess | OpenAI-hosted |
| Best for | Custom agents, full control | Claude / Cursor users | ChatGPT users |
Choose raw function calling when you need the tool loop inside your own service — a backend agent, a queue worker, an eval harness — where MCP's subprocess model does not fit.
Executing the tool call against the API
Both providers hand you back a tool name and arguments. Map the name to an endpoint and make the request — one small dispatcher covers every tool:
import httpx
KEY = "cdk_live_yourkey"
BASE = "https://cryptodataapi.com/api/v1"
H = {"X-API-Key": KEY}
def run_tool(name, args):
if name == "get_daily_snapshot":
url = f"{BASE}/daily"
elif name == "get_coin_profile":
url = f"{BASE}/coins/{args['symbol']}"
elif name == "get_funding_rates":
url = f"{BASE}/derivatives/funding-rates"
else:
return {"error": f"unknown tool {name}"}
return httpx.get(url, headers=H, timeout=15).json()Feed the returned JSON back to the model as the tool result and let it continue reasoning. Because the payloads are already structured and compact, they drop into the context without any reshaping.
Which endpoints make the best tools
You do not need to expose all 100+ endpoints. A tight, well-described set of tools makes the model choose faster and hallucinate less. Start with these:
get_daily_snapshot→/daily— the one-call overview; almost every conversation starts here.get_market_health→/market-health/summary— regime label and 0–100 scores.get_fear_greed→/sentiment/fear-greed— sentiment in one number.get_funding_rates→/derivatives/funding-rates— positioning and crowding.get_coin_profile→/coins/{symbol}— drill into a single asset.get_btc_cycle→/market-intelligence/btc/cycle-indicators— MVRV, NUPL, Puell.
Use raw function calling when you are building the agent yourself and want the tool loop in your own code. The full endpoint catalogue an agent can turn into tools is at /llms-full.txt.
Wire it up: grab a free key at cryptodataapi.com, paste the schemas above, and see the full tool catalogue at cryptodataapi.com/llms-full.txt.



