Skip to main content
Glama

pg_code_graph

Rebuilds incremental AST and bidirectional import dependency graphs across Python, TS/JS, Go, and Rust, revealing affected files and blast radius for focused code changes.

Instructions

Rebuild incremental AST & bidirectional import/blast-radius dependency graph (Python, TS/JS barrel re-exports, Go, Rust).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "pg_code_graph"
  }
}

Input Schema

NameRequiredDescriptionDefault
slotNoWorkspace slot name (optional if only one slot is open or `--slot` default is set).
focus_filesNoOptional relative paths to inspect Imports & ImportedBy blast radius.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv4.7.1

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full disclosure burden. It says 'Rebuild incremental' but never states whether this mutates a persisted index, how expensive the operation is, whether it can be run concurrently with other tools, or what it returns. For an operation with likely side effects on stored state, that is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with no filler; the verb, the artifact, and the supported languages come first. The parenthetical language list is dense jargon but each element is informative.

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

Completeness2/5

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

With no annotations, no output schema, and no return-value description, the agent cannot tell what a rebuild yields (graph data, summary, or nothing) or whether the operation is idempotent. For a build/index tool this leaves too much unspecified relative to its complexity.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already explains both 'slot' and 'focus_files' including the optional-slot behavior and blast-radius scoping. The description adds no syntax or format detail beyond the schema, so the baseline 3 applies.

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 states a specific verb ('Rebuild') and resource ('AST & bidirectional import/blast-radius dependency graph') and scopes it to four language ecosystems (Python, TS/JS barrel re-exports, Go, Rust). An agent can tell this is a graph/index-building tool rather than a search tool like pg_search_code, though it does not explicitly disambiguate from pg_test_impact, which also deals with blast radius.

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

Usage Guidelines2/5

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

There is no explicit when-to-use guidance, no prerequisites, and no named alternatives. The word 'incremental' hints it is meant to be re-run after code changes, but the agent must infer this, and nothing says whether it should precede pg_test_impact or pg_search_code queries.

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