rules.provenance

Live

Query provenance metadata for a Cortex rule.

CategoryRules
JSON-RPCtools/call
EndpointPOST /mcp
Sourcepackages/mcp-tools/src/tools/rules-provenance.ts

Description

Returns the rule's origin: which episode(s) it was synthesized from, how it was created (user explicit vs. system inferred), and how often it has fired. This is the audit primitive — every rule must justify itself.

Input schema

FieldTypeRequiredDescription
rule_idstringyesRule ID to inspect.

Output shape

typescript
{
  ok: boolean;
  provenance?: {
    source_episode_ids: string[];
    created_via: string;
    fired_count: number;
  };
  error?: string;
}

Example call

JSON-RPC tools/call request body (omit the JSON-RPC envelope when using an SDK; the SDK adds it for you):

jsontools/call params
{
  "name": "rules.provenance",
  "arguments": { "rule_id": "rule_01HXP" }
}

Example response

Tool results are always wrapped as content[0].text with a stringified JSON body. The shape below is what you get back from JSON.parse(result.content[0].text):

jsonparsed result body
{
  "ok": true,
  "provenance": {
    "source_episode_ids": ["ep_01HXR"],
    "created_via": "user_explicit",
    "fired_count": 12
  }
}

Errors this tool can return

CodeMeaning
invalid_argumentsTool input failed Zod validation.
unauthorizedMissing or invalid bearer token.

See the full error catalog for resolution steps on each code, plus the standard transport-layer responses (401, 429).