Skip to main content
Glama

explain_fact

Justify a derived Datalog fact by returning the rule that derived it plus supporting body facts. Use to explain dependency edges.

Instructions

Explain WHY a derived (Datalog) fact holds — returns the rule that derived it plus the supporting body facts (why()/provenance).

This is the inverse of "what holds": instead of listing results, it justifies ONE result. Provenance is computed on demand against the current graph snapshot.

Default program is the bundled depends.dl, so the common use is explaining a MODULE→MODULE dependency edge:

  • "Why does module A depend on B?" → explain_fact(predicate="depends", key=["", ""])

For a custom rule, pass its source. key is the fact's ground tuple as wire-string terms (node ids as their decimal id). A null/"no derivation" result means the fact is not derivable by the program (it does not hold as a derived fact).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
predicateYesThe derived predicate to explain (e.g. "depends").
keyYesThe fact's ground key tuple as wire-string terms (node ids as decimal).
sourceNoOptional Datalog program (derive engine); empty/omitted ⇒ the bundled depends.dl.
Behavior4/5

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

With no annotations provided, the description carries full burden and adequately discloses key behaviors: provenance is computed on demand, the return includes the rule and body facts, the key format (wire-string terms, node IDs as decimals), and the meaning of a null result. It does not cover potential side effects or permissions, but these are minimal for a read-only explanation tool.

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 concise (4 sentences) with no filler. It front-loads the core purpose, then explains the inverse relationship, default program, and example. Every sentence is informative and earns its place.

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

Completeness4/5

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

Given the tool has no output schema, the description adequately explains what is returned (rule + body facts). It also covers the key format and null result. Missing details like error handling or pagination are not critical for this type of tool, so completeness is sufficient.

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

Parameters4/5

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

Schema coverage is 100%, but description adds value beyond schema: it provides an example for the common use case (predicate='depends'), specifies that node IDs in the key should be decimal, and explains that omitting source defaults to the bundled depends.dl. This reduces ambiguity for agents.

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

Purpose4/5

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

The description clearly states the tool explains why a derived fact holds and returns the rule and supporting body facts. It uses specific verbs and resources like 'explain WHY a derived (Datalog) fact holds'. However, it does not explicitly distinguish from sibling tools like 'explain' or 'explain_gap', relying on the phrase 'inverse of "what holds"' which may not be sufficient for all agents.

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?

The description provides concrete usage context: the default program is depends.dl, and gives an example for explaining module dependency edges. It also covers custom rules and mentions the null result scenario. However, it does not explicitly state when not to use this tool or list alternatives, though it contrasts with 'what holds'.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Disentinel/grafema'

If you have feedback or need assistance with the MCP directory API, please join our Discord server