Delete a file
delete_fileDeletes 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.
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": {
"owner": "<owner>",
"repo": "<repo>",
"path": "<path>",
"sha": "<sha>"
},
"name": "delete_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sha | Yes | The file's current blob SHA, from `get_file_contents`. | |
| path | Yes | File path from the repository root. | |
| repo | Yes | Repository name. | |
| owner | Yes | Repository owner. | |
| branch | No | Branch to commit to. Defaults to the repository's default branch. | |
| message | No | Commit message. The forge composes one when absent. | |
| new_branch | No | Create this branch from `branch` and commit the deletion there instead. |