Skip to main content
Glama

Scan repository architecture graph

scan_repository_graph
Read-onlyIdempotent

Scans a local repository and returns its architecture graph as JSON with file nodes, import edges, clusters, and metrics. Use it to understand codebase structure and find hub files.

Instructions

Scan a local repository and return its architecture graph as JSON: one node per source file (id, layer, cluster, in/out degree, lines of code), import edges between files, nested directory clusters, and metrics (totalFiles, totalEdges, density, couplingFactor, deadCodeCount, foldedUtilityCount). Use it to understand how a codebase is organised, find hub files, or feed graph data into further analysis. Use query_impact_path instead when you only need the callers of one file, and generate_architecture_html when a human wants a visual map. Every call performs its own fresh static scan of path; no prior scan is required. Reads the local filesystem only, executes nothing, and sends nothing over the network. Supports TypeScript/JavaScript, Python, Go and Rust; external packages are dropped, test files are excluded, and layer labels (entry/business/data/util/unknown) are filename heuristics, not semantic judgements.

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute path to the repository root to scan, e.g. "/home/me/project" or "C:/dev/project". Relative paths resolve against the MCP server process working directory, which is usually not the project, so prefer absolute paths.
maxDepthNoMaximum directory nesting depth to scan below the root. Integer, default 6. Use 0 to scan only files in the root directory; raise it for deeply nested monorepos.
collapseUtilsNoWhether to mark high fan-in utility files (more than 15 callers and at most two dependencies, or utility-like names such as utils/helpers/types/config) as folded. Boolean, default true. Folded nodes stay in the graph data with isFolded: true; set false to treat every file equally.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / collapseUtils / description
      Added value: +"Whether to mark high fan-in utility files (more than 15 callers and at most two dependencies, or utility-like names such as utils/helpers/types/config) as folded. Boolean, default true. Folded nodes stay in the graph data with isFolded: true; set false to treat every file equally."
    • addedInput schema / properties / maxDepth / description
      Added value: +"Maximum directory nesting depth to scan below the root. Integer, default 6. Use 0 to scan only files in the root directory; raise it for deeply nested monorepos."
    • addedInput schema / properties / path / description
      Added value: +"Absolute path to the repository root to scan, e.g. \"/home/me/project\" or \"C:/dev/project\". Relative paths resolve against the MCP server process working directory, which is usually not the project, so prefer absolute paths."
  2. First observedv0.1.1

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the annotations: every call performs a fresh static scan with no prior scan required, reads only the local filesystem, executes nothing and makes no network calls. It also discloses language support, that external packages are dropped and tests excluded, and that layer labels are filename heuristics rather than semantic judgements — a material caveat for interpreting results.

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?

Front-loaded with purpose and output shape, and every clause carries information (alternatives, freshness, safety, language scope, heuristic caveat). It is a single dense paragraph, so the caveats are harder to scan than they would be if separated, but there is no filler.

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?

With no output schema, the description carries the return-value burden and does so by enumerating node fields, edges, clusters, and named metrics. Combined with freshness, safety, and language-scope statements, an agent has everything needed to call it correctly and interpret the result.

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 baseline is 3; the description adds meaning by explaining that folded utility nodes remain in the data with isFolded:true and that layer/cluster labels are heuristics. It does not add syntax guidance for maxDepth or path beyond what the schema already says, so it stops short of a 5.

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?

States a specific verb and resource ('Scan a local repository and return its architecture graph as JSON') and enumerates the return structure (nodes, edges, clusters, metrics). It distinguishes itself from both siblings by name and by what distinguishes them.

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?

Gives explicit use cases ('understand how a codebase is organised, find hub files, or feed graph data into further analysis') and names the alternatives with the conditions that select them: query_impact_path for callers of one file, generate_architecture_html for a human-facing visual map.

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