Skip to main content
Glama

explain_gap

Given a predicate and key, identifies why a Datalog fact is missing by showing the rule, satisfiable premises, and the unmet premise — either a missing fact to add or a blocking fact to remove.

Instructions

Explain why a derived (Datalog) fact does NOT hold — the why-not dual of explain_fact.

Returns the rule whose gap it characterizes, the body premises that WERE satisfiable (with the head bound), and the first premise no binding satisfies:

  • a MISSING positive premise → the gap closes by ADDING such a fact (verify with sim_datalog)

  • a PRESENT negated premise → the gap closes by REMOVING the blocking fact

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

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

A "no gap" result means the fact actually IS derivable (use explain_fact), or no rule head matches the key.

Input Schema

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

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

With no annotations, the description carries full burden. It details the return structure: the rule, satisfiable premises, and the first unsatisfiable premise. It explains the two cases (missing positive vs. present negated) and the 'no gap' result. This is comprehensive behavioral disclosure.

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 well-structured with clear sections explaining the dual nature, return value, interpretation of results, and a concrete example. Every sentence adds value, no fluff. It is appropriately detailed for the complexity.

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

Completeness5/5

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

Despite no output schema, the description fully explains the return value and edge cases. It covers the common use case, default program, and how to interpret results. Given the tool's complexity, the description is complete and self-contained.

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%, so baseline is 3. The description adds context beyond schema: e.g., 'predicate' is the derived predicate, 'key' is ground tuple with wire-string terms and node IDs as decimal, 'source' is optional and defaults to depends.dl. This enriches understanding without redundancy.

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 clearly states the tool explains why a derived fact does NOT hold, positioning it as the dual of explain_fact. It specifies the verb 'explain' and the resource 'missing derived fact', with concrete examples like module dependencies, making it distinct from siblings.

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

Usage Guidelines5/5

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

Explicitly mentions the alternative explain_fact for when the fact is derivable, and provides a canonical use case for missing dependencies. The description guides when to use this tool versus others, e.g., 'A 'no gap' result means the fact actually IS derivable (use explain_fact).'

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