Overview
Context lets coding agents start with a natural-language question, then turn the working answer into a recurring data routine. The common path is:- Ask naturally with
context_query. - Capture the routine recipe from the successful result: question template, assumptions,
toolsUsedIDs, artifacts, and data policy. - Switch to
evidence_onlyplusincludeDataUrlwhen your own agent writes the report. - Pin saved
toolsUsedIDs astoolIdsfor repeatable managed Query runs. - Use
context_executeonly when execute discovery confirms an exact method is available. - Move custom signal logic into your own script when you want deterministic computation over the returned data.
Use
context_query for the managed data product: discovery, execution, grounding, chart generation, and evidence packaging. Use context_execute only for direct method calls that your agent will orchestrate itself.Stage 1: Explore
Start with Auto Mode. Let Context discover tools and return a human-readable answer. Tell your agent:
Use context_query in Auto Mode. Ask: “Using available premium order-flow tools, analyze BTC over the last 60 days at 1h resolution. Do recent flow and CVD signals favor long, short, or neutral high-timeframe bias?”
For this first run:
- Omit
toolIds. - Use the default
answer_with_evidence. - Include named providers in the question text if you care about them, for example “using Coinglass and Velo”.
- If the result returns
jobId, pollcontext_query_statusuntil terminal.
toolsUsed in the structured payload. Those tool IDs are the starting point for a repeatable routine.
Stage 2: Capture The Routine Recipe
Before changing response shapes or pinning tools, ask your agent to save the recipe from the successful run. The recipe should include:questionTemplate: the exact question to run againtoolsUsed: tool names and IDs from the terminalcontext_queryresultassumptions: venue names, asset symbols, time window, interval, and any interpretation choicesresponseShape: usuallyevidence_onlyfor scheduled routinesincludeDataUrl: usuallytruefor full-data handoffreportTemplate: the fields your agent should produce every runsignalPolicy: any local thresholds, prior-run comparison, or “long/short/neutral” decision rule
Stage 3: Let Your Agent Write The Report
Once the question shape is right, switch toevidence_only and request a full-data handle.
Tell your agent:
evidence_only still runs the managed Query runtime. It skips the prose synthesis layer so your own agent can synthesize the result, compare against prior runs, or apply a custom decision rule.
includeDataUrl: true keeps large payloads out of the model context. The result includes a public, fetchable data handle such as dataUrl and often artifacts.canonicalDataRef.
Stage 4: Pin For Repeatability
Auto Mode is the easiest way to discover the right data. For a routine that should behave similarly every day, pin the tool shortlist. Pinned Query means: pass a saved list of marketplacetoolIds to context_query so the managed runtime only uses those tools. Context still handles execution, grounding, charting, and evidence packaging; it just stops broad Auto Mode tool selection from changing the provider shortlist.
Use the prior successful run as the source of truth:
- Read
toolsUsedfrom the completed Stage 1 or Stage 3context_queryresult. - Save the
idandnamefor each tool that actually contributed useful evidence. - Optionally call
context_discoverin query mode to inspect those tools again or search the same domain for nearby alternatives. - Call
context_querywith the savedtoolIds, the same question template,responseShape: "evidence_only", andincludeDataUrl: true. - Store the question template, selected
toolIds, and any local signal thresholds in your repo.
Stage 5: Direct Execute When Available
Use direct execution only after execute discovery proves a method exists.- Call
context_discoverwithmode: "execute". - Inspect returned
mcpTools, schemas, and execute prices. - Call
context_executewith the exacttoolId,toolName, andargs. - Reuse
sessionIdandmaxSpendUsdfor related calls. - Synthesize or compute the final answer in your own agent or script.
- Query mode asks Context to manage the workflow. Tools are selected by
toolIdsor Auto Mode, and Context decides which methods to call internally. - Execute mode asks your agent or script to call one exact method with explicit arguments and pay per call.
context_query grounding into context_execute. Query grounding shows what the managed runtime used or considered; it is not the direct-execute contract.
If execute discovery returns no methods, keep the routine on pinned context_query. That is still a repeatable, production-worthy workflow.
Stage 6: Move Signal Logic Client-Side
When the routine is stable, put the deterministic part in code:- Fetch the terminal query result.
- Read bounded evidence from
structuredContent. - Fetch
dataUrlonly when full rows are needed. - Compute local indicators, thresholds, and prior-run diffs.
- Store the final signal and the Context data reference.
- spot vs perp CVD divergence
- flow z-scores against 30-day and 60-day baselines
- open interest or funding confirmation
- bias:
long,short, orneutral - confidence and invalidation conditions
Copy-Paste Routine Prompt
Use this prompt in Claude Code, Cursor, OpenClaw, or another MCP-capable coding agent:Choosing The Right Level
Use Auto Query when you are exploring a question or want the fastest path to a good answer. Capture a Routine Recipe when the Auto Query result is good enough to preserve. The important field istoolsUsed: those IDs become your first pinned tool candidates.
Use evidence-only Query with dataUrl when your coding agent writes the report, compares against prior runs, or computes a custom signal.
Use pinned Query when you want recurring runs to stay within the same provider/tool shortlist while still using Context’s managed runtime.
Use direct Execute when you already know the exact method and arguments, and execute discovery confirms that method is eligible.
Use your own script when the final decision rule needs deterministic state, thresholds, backtesting, or storage across scheduled runs.
