Skip to main content
Glama

run_datalog

Query the codebase graph with Datalog to find transitive calls, imports, dependencies, hubs, orphans, and circular dependencies using preloaded predicates and custom rules.

Instructions

Run a logic query over the codebase graph. Standard library predicates are pre-loaded (do not redefine them):

  • calls_transitive(X, Y) : X transitively calls Y

  • imports_transitive(X, Y) : X transitively imports Y

  • depends_transitive(X, Y) : X transitively depends on Y

  • same_community(X, Y) : X and Y are in the same Louvain cluster

  • is_hub(X) : X has > 15 connections

  • is_orphan(X) : X has no incoming/outgoing edges

  • circular_dependency(X, Y) : X and Y call each other

  • bypasses_layer(X, Y, Z) : X depends on Z, bypassing intermediary Y Base EDB relations: node, calls, imports, contains, inherits, implements, degree, edge. Supports user rules (:-), goals (?-), facts, and negation (not). Budget-bounded (max 10,000 steps).

Input Schema

NameRequiredDescriptionDefault
queryYesDatalog program text. Supports goals (?-), user rules (:-), facts, and negation (not). Standard library predicates are pre-loaded.
step_budgetNoMaximum solver steps before the query is bounded (default 1000, clamped to 100 through 10000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.23.0
    • addedInput schema / properties / query / description
      Added value: +"Datalog program text. Supports goals (?-), user rules (:-), facts, and negation (not). Standard library predicates are pre-loaded."
    • addedInput schema / properties / step_budget / description
      Added value: +"Maximum solver steps before the query is bounded (default 1000, clamped to 100 through 10000)."
  2. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well by disclosing the step budget (max 10,000 steps), pre-loaded standard predicates, and support for rules, goals, facts, and negation. It stops short of explicitly stating read-only behavior or describing the result shape, which are minor but real gaps.

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 front-loaded with the core purpose, then uses a compact bulleted list for predicates and a short sentence for base relations and constraints. Every sentence contributes useful information without repetition or fluff.

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?

For a complex Datalog query tool with no annotations and no output schema, the description provides strong input-side context: syntax features, standard predicates, base relations, and budget bounds. It is complete enough to invoke correctly, though it does not explain the return format or how to choose this tool over siblings.

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 the schema already documents both parameters. The description adds substantial meaning for the query parameter by enumerating standard-library predicates and base EDB relations, which materially helps an agent construct valid queries. The step-budget behavior is also mentioned consistently with the schema.

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 opens with a specific verb and resource: 'Run a logic query over the codebase graph.' It further clarifies the query language and available predicates, making the tool's purpose concrete. It does not explicitly differentiate itself from siblings such as query_graph or trace_path, so it falls short of a 5.

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

Usage Guidelines3/5

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

The description implies usage by listing standard predicates and supported Datalog constructs, which suggests the tool is for recursive or logic-based graph queries. However, it gives no explicit when-to-use/when-not-to-use guidance and does not name alternatives like query_graph or trace_path.

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