Skip to main content
Glama

guard_patterns

Checks files for forbidden patterns (bare-except, debugger, eval) plus custom rules, acting as a pre-commit gate using AST rules.

Instructions

AST rules: no bare-except/debugger/eval. Custom via .ai-patterns.json. Pre-commit gate with dependency_gatekeeper.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesFile to check (relative to workspace_dir)
rulesetNoOptional ruleset path relative to workspace_dir (default: .ai-patterns.json + built-in)
workspace_dirYesREQUIRED: project root (abs). reindex first if new.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observed

TDQS

A3.5/5.0
Behavior3/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 of behavioral disclosure. It does add context about the specific AST rules, custom config, and its role as a pre-commit gate. However, it does not state whether the tool is read-only, what it returns (e.g., a pass/fail report, violations list, exit codes), or any side effects. This is a notable gap for a tool without annotations, but the provided context is not misleading.

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?

The description is three concise fragments that are front-loaded with 'AST rules' to immediately convey the core purpose. Each sentence adds distinct value: what rules are enforced, how to customize, and how it integrates as a pre-commit gate. There is no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is relatively simple with only three parameters and no output schema, but the description does not explain what the tool returns or the effects of a violation (e.g., blocking a commit). The integration note about dependency_gatekeeper is vague. The schema covers parameters, but the description should at least hint at the tool's output or behavior when a pattern is found; it falls short of that.

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 input schema provides detailed descriptions for all three parameters (file, ruleset, workspace_dir), giving 100% coverage. The description adds no parameter-specific information beyond what the schema already contains. Since the schema carries the load, a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the tool as enforcing AST rules for specific forbidden patterns (bare-except, debugger, eval), and mentions custom rules via .ai-patterns.json. The verb 'guard' is implied by the name and reinforced by 'Pre-commit gate', but it does not explicitly contrast with sibling tools like code_quality or style_sniffer, so it loses a point for lack of sibling differentiation.

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?

The description implies usage as a pre-commit gate, especially 'with dependency_gatekeeper', and suggests customization via a config file. However, it does not provide explicit when-to-use vs alternatives, exclusions, or prerequisites (e.g., needing to reindex first, as hinted in workspace_dir description). This is implied usage, not explicit guidance.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wulun811/LiuHe'

If you have feedback or need assistance with the MCP directory API, please join our Discord server