Skip to main content
Glama

Install Precommit Guard

install_precommit_guard

Install a Git pre-commit guard that blocks commits staging files reserved exclusively by another agent, with optional warning mode and existing hooks preserved.

Instructions

Install the Agent Mail pre-commit guard into a git repository.

The guard blocks a commit that stages files another agent holds an exclusive file reservation on (set AGENT_MAIL_GUARD_MODE=warn to only warn). Commits must run with AGENT_NAME set to the committing agent. Any existing pre-commit hook is kept and still runs. Does nothing when worktree features are disabled (WORKTREES_ENABLED=0).

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": {
      "project_key": "<project_key>",
      "code_repo_path": "<code_repo_path>"
    },
    "name": "install_precommit_guard"
  }
}

Input Schema

NameRequiredDescriptionDefault
formatNoOutput format.
project_keyYesProject whose file reservations the guard enforces.
code_repo_pathYesPath to the git repository to install the hook into.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.3.5
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / code_repo_path / description
      Added value: +"Path to the git repository to install the hook into."
    • addedInput schema / properties / format / description
      Added value: +"Output format."
    • addedInput schema / properties / project_key / description
      Added value: +"Project whose file reservations the guard enforces."
  2. First observedv0.3.4

TDQS

A3.9/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full disclosure burden and does a fair amount: it describes the blocking behavior, the env-var prerequisites, preservation of existing hooks, and the disabled-worktrees no-op. It omits idempotency (what happens on re-install), filesystem mutation details, and error conditions, which are material for an installer that writes into a repository.

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?

Front-loaded with the one-line purpose, followed by parenthesized mode options and edge conditions. Every sentence carries behavioral information, though the env-var notes are packed into a dense block that could be split for scanability.

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

Completeness4/5

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

An output schema exists so return values need no explanation, and the description covers prerequisites, side effects on existing hooks, and the no-op condition. Re-install/idempotency behavior and any failure modes are the remaining gaps for a tool that mutates a repository.

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 parameters are already documented, and the description only echoes the meaning of project_key ('file reservations the guard enforces') and implicitly the repository path. The 'format' parameter is not addressed, and no added syntax or constraints are provided beyond the schema.

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 and resource ('Install the Agent Mail pre-commit guard into a git repository') and immediately explains the effect it has on commits, so an agent can distinguish it from the sibling uninstall_precommit_guard without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Makes the operating context clear: commits must run with AGENT_NAME set, warn-only mode is enabled via AGENT_MAIL_GUARD_MODE, and the tool is a no-op when WORKTREES_ENABLED=0. It stops short of naming alternatives or stating exclusions such as what to do if a guard is already installed.

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