Skip to main content
Glama

enforce_architecture_boundaries

Enforces T-4 architectural boundary rules by auditing import statements to detect unauthorized cross-layer imports and verify modular separation.

Instructions

Enforces T-4 architectural boundary rules (tzero.rules.json), verifying modular separation and detecting unauthorized cross-layer imports.

Behavior:

  • Read-only: Audits import AST statements; does NOT block git, mutate code, or modify configuration files.

  • Idempotent: Yields consistent validation results for any given codebase state.

  • 100% Offline: Local AST validation without external dependencies.

Usage Guidelines:

  • When to use: Run in CI/CD pipelines or before committing to verify that presentation/UI layers do not import internal database/storage modules directly.

  • Sibling Routing: To view active boundary rules without evaluating code, use 'query_architecture_boundaries'. For general code quality smells, use 'audit_codebase_quality'.

Returns: Compliance report detailing pass/fail status, violating file paths, line numbers, layer names, and allowed import directions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rules_fileNoPath to rules JSON file (default: 'tzero.rules.json'). Resolves relative to project_root.tzero.rules.json
project_rootNoWorkspace root to validate against architectural rules (default: current directory)..

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.1.1
    • addedInput schema / properties / project_root / description
      Added value: +"Workspace root to validate against architectural rules (default: current directory)."
    • addedInput schema / properties / rules_file / description
      Added value: +"Path to rules JSON file (default: 'tzero.rules.json'). Resolves relative to project_root."
  2. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden and does so well: it declares read-only (audits AST, does not block git/mutate/modify config), idempotent, and fully offline. This is strong disclosure. It stops short of noting rate limits, error behavior, or permissions, so not a full 5.

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?

Well-structured with a summary sentence, then Behavior, Usage Guidelines, and Returns sections. Front-loaded purpose, every line earns its place, no redundancy.

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?

Complete for a codebase-audit tool: purpose, behavior traits, when-to-use, sibling routing, and return shape are all present. With an output schema existing, the 'Returns' line is a helpful summary rather than a necessity, and the description still covers everything an agent needs to invoke it correctly.

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% for both params (rules_file, project_root), so the schema already documents defaults and resolution. The description mentions tzero.rules.json but adds no parsing detail, path semantics, or fallback behavior beyond what the schema states. Baseline 3 is appropriate.

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 (enforces) and a well-defined resource (T-4 architectural boundary rules from tzero.rules.json), plus what it verifies: modular separation and unauthorized cross-layer imports. Clearly distinguishes from siblings like query_architecture_boundaries (view rules) and audit_codebase_quality (general smells).

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?

Explicit 'when to use' (CI/CD pipelines, before committing, to verify layer isolation) and explicit sibling routing naming two alternatives with the conditions that select them. Nothing left to inference.

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