Install
pip install ctxprotocol
Pinned Query mode
import asyncio
import os
from ctxprotocol import ContextClient
MERIDIAN_TOOL_ID = "e5e62fa5-28e1-42f4-8b84-f4866234df43"
async def main() -> None:
async with ContextClient(api_key=os.environ["CONTEXT_API_KEY"]) as client:
result = await client.query.run(
query=(
"Use Meridian futures for BTCUSDT on Binance, Bybit, OKX, and "
"Hyperliquid. Return 1h rows from 2026-07-13T00:00:00Z to "
"2026-07-13T06:00:00Z with close_price, funding_rate, "
"dollar_open_interest_close, and coverage metadata."
),
tools=[MERIDIAN_TOOL_ID],
response_shape="evidence_only",
include_data=True,
include_data_url=True,
)
print(result.evidence)
print(result.data)
asyncio.run(main())
Direct Execute mode
import asyncio
import os
from ctxprotocol import ContextClient
MERIDIAN_TOOL_ID = "e5e62fa5-28e1-42f4-8b84-f4866234df43"
async def main() -> None:
async with ContextClient(api_key=os.environ["CONTEXT_API_KEY"]) as client:
matches = await client.discovery.search(
"Meridian crypto futures data",
mode="execute",
surface="execute",
require_execute_pricing=True,
)
meridian = next(
(tool for tool in matches if tool.id == MERIDIAN_TOOL_ID),
None,
)
if meridian is None or not any(
method.name == "futures" for method in meridian.mcp_tools
):
raise RuntimeError("Meridian futures is not currently Execute-eligible")
result = await client.tools.execute(
tool_id=MERIDIAN_TOOL_ID,
tool_name="futures",
args={
"exchanges": ["binance", "bybit", "okx", "hyperliquid"],
"products": ["BTCUSDT"],
"columns": [
"close_price",
"funding_rate",
"dollar_open_interest_close",
],
"begin": "2026-07-13T00:00:00Z",
"end": "2026-07-13T06:00:00Z",
"resolution": "1h",
"include": {
"coverage": True,
"provenance": True,
"column_metadata": True,
},
},
max_spend_usd="0.10",
close_session=True,
)
print(result.result)
asyncio.run(main())
Use
async with ContextClient(...) or close the client explicitly so HTTP resources are released cleanly.