edit_file
Update a file in a Bitbucket repository by committing new content. Returns commit metadata and supports optimistic locking to prevent conflicts.
Instructions
Edit a file in a repository by committing a new version via the Bitbucket REST API. Returns the commit metadata.
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": {
"repository": "<repository>",
"filePath": "<filePath>",
"branch": "<branch>",
"content": "<content>",
"message": "<message>"
},
"name": "edit_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch | Yes | Target branch name. | |
| content | Yes | Full new file content as a string. | |
| message | Yes | Commit message. | |
| project | No | Project key. Defaults to BITBUCKET_DEFAULT_PROJECT. | |
| filePath | Yes | Path to the file in the repository. | |
| repository | Yes | Repository slug. | |
| sourceBranch | No | Fork point branch when creating a new branch. | |
| sourceCommitId | No | Current commit ID for optimistic locking. If provided and the branch has advanced, the request will fail with a 409 conflict. |