commit_changes
Create or update a single file on a branch in one commit. Auto-detects file existence and handles creation or update.
Instructions
Create or update a single file on a branch in one commit.
Auto-detects whether the file exists:
File does not exist on the branch: Gitea returns 404 to the SHA lookup; we
POSTto create the file.File exists: we use its current SHA and
PUTto update it.
Returns Gitea's FileResponse shape (the resulting commit + content
metadata). Raises :class:GiteaAPIError on conflicts (e.g. concurrent
update changed the SHA between our lookup and our write — caller should
re-read and retry).
Single-file only. Multi-file commits would require Gitea's Git Trees API and are deliberately out of scope for this tool.
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>",
"branch": "<branch>",
"path": "<path>",
"content": "<content>",
"message": "<message>"
},
"name": "commit_changes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner | |
| repo | Yes | Repository name | |
| branch | Yes | Branch to commit to (must exist; use create_branch first) | |
| path | Yes | File path within the repository, e.g. 'README.md' | |
| content | Yes | New file content (UTF-8 text; binary files not supported) | |
| message | Yes | Commit message |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||