Skip to main content
Glama

audit_codebase_architecture

Scans a local repository to detect circular dependencies, coupling hotspots, layer violations, and reliability/security anti-patterns, returning a 0-100 health score and Mermaid dependency graph.

Instructions

Scan a local repository directory on disk to detect circular module dependencies (Tarjan SCC), coupling/instability hotspots (Ca/Ce/I), layer boundary violations, and 12 production reliability/security/SOLID anti-patterns (N+1 queries in loops, missing HTTP timeouts, unbounded caches, check-then-act races, SQL/command injection, God modules). Outputs a 0-100 health score and Mermaid dependency graph.

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": {
      "directoryPath": "<directoryPath>"
    },
    "name": "audit_codebase_architecture"
  }
}

Input Schema

NameRequiredDescriptionDefault
maxFilesNoMaximum source files to scan (default 250).
maxFileLinesNoLOC threshold for God File detection (default 500).
directoryPathYesAbsolute or relative path to the project directory to audit.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/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 disclose substantial behavior: the specific analysis algorithms, the category of patterns flagged, and the exact form of the return (health score plus Mermaid graph). What remains undisclosed is the safety profile (read-only status is only implied by "scan"), whether anything is written to disk, and rough runtime cost on large repos.

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?

Two sentences, front-loaded with the verb and scope, then a parenthetical inventory of detections and a closing statement of outputs. The density is high but every clause carries information; the parenthetical examples of anti-patterns are what make the scope checkable rather than vague.

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?

The tool has no output schema, and the description compensates by stating the two return artifacts, so an agent knows what comes back. For a three-parameter, no-annotation tool the definition is nearly complete; the gap is behavioral (read-only guarantee, cost on large repos) rather than functional.

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 all three parameters are already documented, and the baseline is 3. The description adds only marginal meaning beyond that, mainly by naming "God modules" as a detection target, which a reader can connect to the maxFileLines threshold. No scanning syntax, path-format, or limit-tuning guidance is offered.

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?

Names a specific verb and resource ("Scan a local repository directory on disk") and then enumerates exactly what is detected: circular deps via Tarjan SCC, Ca/Ce/I coupling hotspots, layer violations, and a concrete list of 12 anti-patterns. It also states the outputs (0-100 health score, Mermaid graph), so an agent can tell it apart from a snippet-level auditor without opening the schema.

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?

Usage context is implied by "local repository directory on disk" and "codebase architecture," which rules out snippet- or remote-level audits. However, it never states when to prefer this over a snippet-level audit or any other sibling, nor does it give prerequisites such as needing a locally accessible path. Guidance is inferred rather than stated.

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