Skip to main content
Glama

Write a config file with a git checkpoint

git_safe_write_with_checkpoint
Idempotent

Write a Home Assistant config file after committing a git checkpoint of its prior state, then commit the new content to keep a rollback point.

Instructions

Write one config file after committing a checkpoint of the prior state.

Stages and commits every uncommitted change under /config as a checkpoint commit (only when the tree is dirty), then calls the same write_config_file logic files_write_config_file uses for relative_path/content, and finally stages and commits that change with commit_message (or a default message) if the write succeeded.

Use when: overwriting a config file while keeping a git-based rollback point, unlike a plain overwrite. Not for: a write without a checkpoint — use files_write_config_file; ESPHome device YAML — use esphome_write_config. Returns: dict — the underlying write result ({"success": True, "path": ...} or {"success": False, "error": ...}), plus git_sha/ git_message when the new-content commit was made. Errors: raises RuntimeError (from _repo()) when no git repo exists — run git_git_init_config first; returns {"success": False, "error": ...} unchanged when YAML validation fails, in which case the checkpoint commit of the prior dirty state (if any) still happened, but no new-content commit is made. Limits: does not reload Home Assistant; same file-extension and location limits as files_write_config_file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesFull text to write as the file's new content, replacing whatever was there before.
relative_pathYesPath to the file relative to the HA config directory to write, e.g. 'automations.yaml'. Same extension and location limits as `files_write_config_file`.
commit_messageNoCommit message for the new-content commit. Omit to use a default 'chore: update <relative_path>' message.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.25.1
    • addedInput schema / properties / commit_message / description
      Added value: +"Commit message for the new-content commit. Omit to use a default 'chore: update <relative_path>' message."
    • addedInput schema / properties / content / description
      Added value: +"Full text to write as the file's new content, replacing whatever was there before."
    • addedInput schema / properties / relative_path / description
      Added value: +"Path to the file relative to the HA config directory to write, e.g. 'automations.yaml'. Same extension and location limits as `files_write_config_file`."
  2. First observedv0.3.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond annotations: discloses the checkpoint-commit ordering, that the checkpoint only fires when the tree is dirty, the partial-failure semantics (checkpoint still made but no new-content commit on YAML validation failure), the RuntimeError when no git repo exists, and that HA is not reloaded. Annotations only cover readOnly/destructive/idempotent hints; this adds the real behavioral contract.

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-loads the core action, then structured Use/Not-for/Returns/Errors/Limits blocks. Slightly dense but every clause carries information; no filler.

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?

Covers sequencing, prerequisite (git init), partial-failure behavior, return shape, and limits — full coverage for a 3-param mutating tool even though an output schema exists.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. Description adds the default-message behavior for `commit_message` ('chore: update <relative_path>') and clarifies that `relative_path`/`content` reuse `files_write_config_file` semantics, which is meaningful value beyond the schema text.

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+resource (write one config file) with the distinctive compound behavior (git checkpoint before/after). Explicitly distinguishes from siblings `files_write_config_file` (plain overwrite) and `esphome_write_config` (ESPHome YAML).

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?

Provides explicit 'Use when' and 'Not for' sections naming the alternative tools for each exclusion case. The condition selecting this tool over a plain overwrite is unambiguous.

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

Deploy Server

Other Tools