Skip to main content
Glama

Generate High Density AST Architectural Passport for LLMs

generate_architectural_passport
Read-onlyIdempotent

Generates a compact, prompt-ready AST architectural passport for a Python source file, distilling module purpose, layer role, complexity, exports, and dependencies for LLM grounding.

Instructions

Generates an ultra-dense, prompt-ready AST architectural passport for a target source file, distinguishing from 'build_project_context' which outputs a multi-tier repository tree and 'generate_architecture_blueprint' which builds Mermaid diagrams by distilling module purpose, layer role, cyclomatic complexity, exported symbol contracts, and dependency topologies into a compact prompt block with up to 95% token savings.

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.

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?

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the Mutability/Idempotency lines largely restate structured data. However the description goes beyond them with concrete latency (<20ms), memory (<30MB), zero-credential/zero-rate-limit, offline-privacy, and missing/unparseable-file error behavior — genuinely useful operational context for an annotation-covered tool.

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?

Section headings make it scannable, but the opening sentence is a single long run-on that buries the core purpose under feature lists, and the Mutability/Idempotency bullets duplicate annotations without adding value. For a one-parameter tool this is noticeably heavier than needed.

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?

Despite the existence of an output schema and full annotation coverage, the description still conveys enough about scope, performance envelope, and error conditions for an agent to call it correctly and set expectations. Nothing needed for correct invocation is missing.

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% and the single `file_path` param is already documented in the schema almost verbatim ("Absolute or relative path to the Python source file"). The description's parameter line adds no syntax, format, or constraint information beyond the schema, so baseline 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?

The description states a specific verb and artifact ("Generates an ultra-dense, prompt-ready AST architectural passport") scoped to a single source file, and explicitly contrasts it with two named siblings ('build_project_context' for repo trees, 'generate_architecture_blueprint' for Mermaid diagrams). An agent can disambiguate without opening any schema.

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?

Dedicated "When to use" and "When NOT to use" sections name concrete triggers (grounding LLMs on a module, authoring code, evaluating complexity) and route each exclusion to the correct alternative tool. No inference required.

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