Skip to main content
Glama
Hardik-Singh

Invariance MCP

Official
by Hardik-Singh

cortex_run_counterfactual

Run a counterfactual evaluation to estimate what might have happened under a hypothetical change, returning a hypothesis with assumptions, evidence references, and confidence.

Instructions

Convenience wrapper around cortex_run_job for job_kind="counterfactual_eval": estimates what MIGHT have happened under a hypothetical change. Result is a HYPOTHESIS, not fact — it carries assumptions, evidence_refs, confidence, and uncertainty. question is required.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
optionsNoJSON object of execution options. Keys: use_llm (boolean), create_surface_item (boolean), timeout_ms (number), dedupe_key (string). Example: {"use_llm":true,"create_surface_item":false}
criteriaNoJSON object describing what the eval is optimizing for. Free-form per job_kind, but typical keys: optimize_for (string[]), constraints (string[]), pass_threshold (number 0..1). Example: {"optimize_for":["resolution_time"],"constraints":["do_not_expose_private_evidence"]}
questionYesThe what-if question. Required. Example: "What if Alice owned this escalation from the start?"
input_refsNoJSON object of evidence references the runner may use. Optional keys: run_ids (string[]), case_ids (string[]), node_ids (string[]), chunk_ids (string[]), surface_item_ids (string[]). The platform ACL-filters these before prompt construction; refs the caller cannot access are dropped or the job is denied. Example: {"run_ids":["run_1"],"case_ids":["case_123"]}
project_idYes
target_refYes
target_typeYes
input_payloadNoJSON object for inline target data. Required when target_type="external" (the target isn't a row in our DB). Example: {"workflow_name":"refund approval","steps":[]}

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds meaningful behavioral context beyond the annotations by warning that the result is a 'HYPOTHESIS, not fact' and naming the output fields: assumptions, evidence_refs, confidence, and uncertainty. This is valuable because annotations only say readOnlyHint=false, openWorldHint=true, destructiveHint=false. It does not disclose side effects like whether a run record is created, but the wrapper framing plus annotations make the operation's non-read-only nature reasonably clear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three tight sentences with no filler. Purpose is front-loaded in the first clause, the important hypothesis caveat follows immediately, and the final sentence flags the critical required parameter. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description provides a strong high-level mental model, including result semantics and the underlying job kind. However, for an 8-parameter tool with no output schema and three undocumented required fields, it leaves gaps: it does not explain what target_type/target_ref should be, whether the call is asynchronous or creates a persistent run, or how the result is delivered beyond the named fields. This is adequate but not fully self-sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description only says `question` is required, which the schema already encodes via `required` and `minLength`. It adds no semantic explanation for the other required parameters—`target_type`, `target_ref`, and `project_id`—which lack schema descriptions. With 63% schema description coverage, the description should compensate for at least the required undocumented fields, but it does not.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: it 'estimates what MIGHT have happened under a hypothetical change' as a counterfactual_eval job. Naming itself a 'convenience wrapper around cortex_run_job' makes its relationship to the generic job tool explicit and distinguishes it from siblings like cortex_run_eval. This is not a tautology and gives an agent a clear, non-confusable purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly identifies when to use the tool: when job_kind='counterfactual_eval', and frames it as a convenience wrapper over cortex_run_job. This is useful selection guidance. However, it does not mention alternative tools such as cortex_run_eval or state explicit exclusion criteria, so it stops short of full when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools