put_file
Create or update a file in a GitHub repository via the Contents API. Supply file path, content, and commit message; include SHA for idempotent updates.
Instructions
Create or update a file via the Contents API. Idempotent when sha is correctly supplied for updates.
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>",
"content": "<content>",
"message": "<message>"
},
"name": "put_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | GitHub owner/org name. | |
| repo | Yes | Repository name. | |
| path | Yes | File path within the repo, no leading slash. | |
| content | Yes | UTF-8 file content. Will be base64-encoded for transport. | |
| message | Yes | Commit message. | |
| branch | No | Target branch. Default: the default branch. | |
| sha | No | Required when updating; the current blob SHA from get_file. Omit for create. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||