run_datalog
Run Datalog logic queries over a codebase graph to detect transitive calls, imports, dependencies, circular dependencies, hubs, orphans, and layer bypasses using preloaded predicates.
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).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "run_datalog"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Datalog program text. Supports goals (?-), user rules (:-), facts, and negation (not). Standard library predicates are pre-loaded. | |
| format | No | Output format: 'text' (default, Markdown) or 'json' (datalog.v1 machine-readable report with per-query rows, variables, and step metadata). | |
| step_budget | No | Maximum solver steps before the query is bounded (default 1000, clamped to 100 through 10000). |