Skip to main content
Glama

enforce_architecture_rules

Read-onlyIdempotent

Enforces architectural boundary rules by validating import graph compliance, preventing layer violations and architectural erosion in CI/CD pipelines.

Instructions

Enforces architectural boundary rules and layer isolation constraints defined in tzero.rules.json across the repository AST, distinguishing from 'manage_architecture_rules' and 'analyze_code_dependencies' by validating import graph compliance against defined architectural layers rather than editing rule definitions or tracing raw calls.

Parameters:

  • project_root (str, optional, default='.'): Root directory of the repository to validate (default: current directory).

  • strict_mode (bool, optional, default=True): When True, fails on any boundary infraction; when False, warns without raising errors.

Behavior:

  • Read-only: Scans codebase imports and call paths; does not alter files.

  • Idempotent: Deterministic violation reporting for identical codebase states.

  • 100% Offline: Local import graph validation against configured boundaries.

  • Auth & Rate Limits: Zero authentication or API keys required; completes in <500ms.

  • Error Handling: Reports missing configuration and lists passed vs violated rules clearly.

Usage Guidelines:

  • When to use: Run in CI/CD pipelines or before merging PRs to prevent architectural erosion (e.g. presentation layer importing database models or circular module dependencies).

  • When NOT to use: Do not use for creating, viewing, or editing architectural boundary definitions (use 'manage_architecture_rules' instead); do not use for inspecting general dependencies between modules (use 'analyze_code_dependencies' instead).

Returns: Detailed compliance audit report listing passed layer boundaries, identified architectural violations, and remediation guidance.

Input Schema

NameRequiredDescriptionDefault
strict_modeNoWhen True, fails on any boundary infraction; when False, warns without raising errors.
project_rootNoRoot directory of the repository to validate (default: current directory)..

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv7.3.2
  2. Removedv7.0.1
  3. Addedv7.0.0

TDQS

A4.6/5.0
Behavior5/5

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

Beyond annotations that already mark it read-only and idempotent, the description adds operational details: 100% offline validation, zero auth/API keys, <500ms completion, and error handling for missing configuration. It also clarifies that validation scans imports/call paths and produces a compliance audit report, which is meaningful behavioral context.

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?

The description is well structured and front-loads purpose and sibling differentiation before detailed behavior and usage. It is somewhat long and repeats some annotation-backed properties and schema parameter text, but the structure keeps it readable and useful.

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?

The description is complete for a validation tool: it covers purpose, alternatives, execution profile, error handling, and expected returns. With an output schema and rich annotations also present, no critical information is missing for correct invocation.

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 both parameters are already well documented. The description's parameter section largely restates the schema's own descriptions for 'project_root' and 'strict_mode' without adding syntax or format details beyond them. Baseline 3 is appropriate when the schema does the heavy lifting.

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 resource ('Enforces architectural boundary rules and layer isolation constraints') and explicitly distinguishes itself from 'manage_architecture_rules' and 'analyze_code_dependencies' by contrast of role. An agent can identify exactly what this tool does and how it differs from siblings 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?

It gives explicit when-to-use guidance ('CI/CD pipelines or before merging PRs') and explicit when-NOT-to-use alternatives for rule management and dependency inspection. The routing conditions are concrete and actionable.

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