Skip to main content

Install

npm install @ctxprotocol/sdk
Node.js 18 or newer is required by the Context SDK.

Pinned Query mode

Pinned Query mode is the recommended default for agent and research workflows.
import { ContextClient } from "@ctxprotocol/sdk";

const MERIDIAN_TOOL_ID = "e5e62fa5-28e1-42f4-8b84-f4866234df43";

const client = new ContextClient({
  apiKey: process.env.CONTEXT_API_KEY!,
});

const 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.",
    "Include close_price, funding_rate, dollar_open_interest_close,",
    "buy_dollar_volume, sell_dollar_volume, and coverage metadata."
  ].join(" "),
  tools: [MERIDIAN_TOOL_ID],
  responseShape: "evidence_only",
  includeData: true,
  includeDataUrl: true,
});

console.log(result.evidence);
console.log(result.data);

Direct Execute mode

Execute only after discovery confirms that the method is eligible and has explicit execution pricing.
const tools = await client.discovery.search({
  query: "Meridian crypto futures data",
  mode: "execute",
  surface: "execute",
  requireExecutePricing: true,
});

const meridian = tools.find((tool) => tool.id === MERIDIAN_TOOL_ID);
const futures = meridian?.mcpTools?.find((method) => method.name === "futures");

if (!meridian || !futures) {
  throw new Error("Meridian futures is not currently Execute-eligible");
}

const result = await client.tools.execute({
  toolId: MERIDIAN_TOOL_ID,
  toolName: "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
    }
  },
  maxSpendUsd: "0.10",
  closeSession: true,
});

console.log(result.result);

Large results

For broad historical queries, request includeDataUrl: true in Query mode. Read the bounded evidence first and fetch the complete dataset only when the application needs every row.