Skip to main content
Glama

Delete a file

delete_file
DestructiveIdempotent

Deletes a file in a Forgejo repository as a single commit using the current blob SHA, optionally targeting a branch or creating a new one. Use it to remove files via the API.

Instructions

Delete a file as a single commit (owner/repo/path/sha; requires write mode). sha is the file's current blob SHA from get_file_contents; a stale one is refused. Commits to branch (default: the default branch), or to new_branch created from it. Answers with the commit.

Input Schema

NameRequiredDescriptionDefault
shaYesThe file's current blob SHA, from `get_file_contents`.
pathYesFile path from the repository root.
repoYesRepository name.
ownerYesRepository owner.
branchNoBranch to commit to. Defaults to the repository's default branch.
messageNoCommit message. The forge composes one when absent.
new_branchNoCreate this branch from `branch` and commit the deletion there instead.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.26.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already flag destructiveHint and idempotentHint, but the description adds real context beyond them: the write-mode auth requirement, the stale-SHA refusal behaviour, and the commit target semantics (branch vs. new_branch created from it). It omits only failure/error surface details.

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 action and required addressing, then prerequisites, then branch behaviour. Dense and largely waste-free, though the parenthetical key list and the punting of `message` to forge defaults make the second sentence a little packed.

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?

For a destructive mutation with no output schema, the description covers auth prerequisites, staleness safety, branch targeting, and states that the response is the commit. Nothing critical to correct invocation is missing.

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 a 3, and the description earns above that by explaining provenance ('sha is the file's current blob SHA from get_file_contents') and the relationship between branch and new_branch that the schema only states in isolation.

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 opens with a specific verb+resource ('Delete a file as a single commit') and immediately names the four-part addressing scheme (owner/repo/path/sha). It is clearly distinguishable from sibling mutations like delete_branch or delete_repo.

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?

It states the prerequisite ('requires write mode') and where the sha must come from ('get_file_contents'), with the consequence of a stale value. It does not explicitly contrast with create_or_update_file for content removal, so it stops just short of full alternative routing.

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