Skip to main content
Glama

Delete a config file

files_delete_config_file
DestructiveIdempotent

Permanently deletes one YAML, JSON, or TXT file under /config only after explicit confirmation, so you can remove Home Assistant config files no longer needed.

Instructions

Permanently delete one config file under /config after an explicit confirmation.

Without confirm=True returns a confirmation prompt and does not resolve or touch relative_path at all. With confirm=True, resolves relative_path via _safe_path and calls Path.unlink(); there is no backup or trash in this tool — deletion is immediate and irreversible from here alone.

Use when: removing a YAML/JSON/txt file that HA no longer needs, once that removal is confirmed. Not for: keeping the ability to undo — commit the config to git first (git_commit_all) or write through git_safe_write_with_checkpoint so a rollback stays possible. Returns: dict {"success": True, "deleted": ...} when confirmed, otherwise a confirmation prompt. Errors: returns {"error": "confirmation_required", "message": ..., "action": ...} when confirm is false; raises FileNotFoundError when the file does not exist, and raises PermissionError (from _safe_path) for a path outside the config directory, a disallowed extension, or secrets.yaml/.storage. Limits: requires confirm=True; the deletion runs immediately with no undo once confirmed.

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": {
      "relative_path": "<relative_path>"
    },
    "name": "files_delete_config_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
confirmNoSet true to actually delete the file. False (default) performs no action and instead returns a confirmation prompt; `relative_path` is not resolved or touched in that case.
relative_pathYesPath to the file relative to the HA config directory (HA_CONFIG_PATH) to delete, e.g. 'packages/old.yaml'. Must use an allowed extension (.yaml/.yml/.json/.txt) and not touch secrets.yaml or .storage/.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.25.1
    • addedInput schema / properties / confirm
      Added value: +{
      +  "default": false,
      +  "description": "Set true to actually delete the file. False (default) performs no action and instead returns a confirmation prompt; `relative_path` is not resolved or touched in that case.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / relative_path / description
      Added value: +"Path to the file relative to the HA config directory (HA_CONFIG_PATH) to delete, e.g. 'packages/old.yaml'. Must use an allowed extension (.yaml/.yml/.json/.txt) and not touch secrets.yaml or .storage/."
  2. First observedv0.3.0

TDQS

A4.6/5.0
Behavior4/5

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

Beyond the annotations (destructiveHint=true, idempotentHint=true), the description discloses the two-phase confirm behavior, that relative_path is untouched without confirm=True, that deletion uses Path.unlink() with no backup/trash, and the specific error classes raised (FileNotFoundError, PermissionError from _safe_path). The only deduction is repeated restatement of irreversibility in both the opening and the Limits line rather than adding new detail.

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?

Well front-loaded: the destructive nature and confirmation gate come first, then labeled sections (Use when / Not for / Returns / Errors / Limits). Slightly over-long because 'irreversible/no undo' is stated three times and the Returns section duplicates the existing output schema.

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?

For a destructive two-parameter tool this covers everything an agent must know: preconditions, side effects, irreversibility, and failure modes. Returns are already specified by the output schema, so the extra Returns line is harmless redundancy rather than a gap.

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 the baseline is 3; the description earns a point by explaining what actually happens on each branch — confirm=False short-circuits before path resolution, confirm=True resolves through _safe_path then calls unlink — and by tying PermissionError to the relative_path validation rules. Some of this overlaps the schema's own confirm description.

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 first sentence states a specific verb and resource ('Permanently delete one config file under /config') and adds the gating condition ('after an explicit confirmation'). Scope ('one file', 'under /config') distinguishes it from write/append/rollback siblings without opening their 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?

Explicit 'Use when' (removing a YAML/JSON/txt file HA no longer needs, once confirmed) and 'Not for' (when undo must remain possible), naming concrete alternatives: git_commit_all and git_safe_write_with_checkpoint. This is exactly the when/when-not/alternative structure an agent needs to route correctly.

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