Skip to main content
Glama

Generate High Density AST Architectural Passport for LLMs

generate_architectural_passport
Read-onlyIdempotent

Generates a read-only architectural passport for a single Python file, giving LLMs prompt-ready module contracts for grounded code generation and complexity or layer-boundary review.

Instructions

Returns a compact architectural passport for one Python file, distinguishing from 'build_project_context' for repository context, 'build_ast_snapshot' for a persisted index, and 'generate_architecture_blueprint' for repository diagrams.

Parameters:

  • file_path (str, required): Absolute or relative path to the Python source code file to analyze.

Behavior:

  • Mutability: Strictly read-only; does not modify source files or write to disk.

  • Idempotency: Deterministic AST extraction producing identical passports for identical source files.

  • Performance & Latency: Generates complete architectural passport in <20ms using local AST parsing.

  • Resources: Consumes <30MB RAM; zero disk footprint.

  • Privacy: 100% offline local processing; zero external network transmission.

  • Auth & Limits: Zero external credentials or API keys required; zero rate limits.

  • Error Handling: Returns clear error notification if target file is missing or unparseable.

Usage Guidelines:

  • When to use: Use when grounding LLMs on a specific module or service before authoring code, generating prompt-ready architectural contracts, or evaluating module complexity and layer boundaries.

  • When NOT to use: Do not use for entire repository multi-tier trees (use 'build_project_context' instead); do not use for graphical Mermaid visual diagrams (use 'generate_architecture_blueprint' instead).

Returns: Formatted Markdown architectural passport block ready for immediate LLM prompt ingestion.

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": {
      "file_path": "<file_path>"
    },
    "name": "generate_architectural_passport"
  }
}

Input Schema

NameRequiredDescriptionDefault
file_pathYesAbsolute or relative path to the Python source file to inspect.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv10.6.0

TDQS

A4.3/5.0
Behavior4/5

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

Goes well beyond the annotations by adding latency (<20ms), memory ceiling (<30MB), zero disk footprint, offline/no-network privacy posture, no credentials or rate limits, and the error behavior for missing or unparseable files — none of which the structured fields convey. The Mutability and Idempotency bullets largely restate readOnlyHint/destructiveHint/idempotentHint, so a small portion earns no credit, but the operational profile is genuinely additive.

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

Conciseness3/5

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

The routing sentence is correctly front-loaded and the sectioned layout is scannable, but the body is bloated for a one-parameter read-only tool: Privacy, Resources, Auth & Limits and Performance bullets read as boilerplate, and Mutability/Idempotency duplicate annotations verbatim. The Returns line is also redundant given an output schema exists.

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?

For a single-required-parameter, read-only, deterministic tool with an output schema, an agent has everything needed to call it correctly: what it produces, when to choose it, when to choose a sibling, failure modes, and cost profile. Return-value detail is legitimately delegated to the output schema.

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?

The single file_path parameter has 100% schema description coverage, so the schema already carries its meaning. The description's parenthetical restates the same information (absolute or relative path to the Python source file) without adding format examples, path resolution behavior, or constraints, so the baseline of 3 applies.

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?

"Returns a compact architectural passport for one Python file" names a specific verb and resource with explicit scope (single file, not repository). The first sentence additionally names three siblings — build_project_context, build_ast_snapshot, generate_architecture_blueprint — and says how this tool differs from each, so the agent can discriminate without opening schemas.

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?

Provides a dedicated when-to-use list (grounding LLMs on a module, prompt-ready architectural contracts, complexity/layer evaluation) and a when-NOT-to-use list that routes to the correct alternative for repo-wide trees and for Mermaid diagrams. Exclusions and alternatives are both explicit, which is the top bar for this dimension.

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