Skip to content

update_file

Overwrite an existing file in a Bridge Town project and commit the change. The path is project-relative (e.g. ‘README.md’, ‘model/revenue.py’, ‘data/seed.csv’, ‘assets/logo.png’). This tool is strict update-only: if the file does not exist it returns a not-found error instructing you to use create_file instead. Specify branch to commit to a non-default branch (e.g.

NameTypeRequiredDefaultDescription
project_nameAnnotated[str, Field(description='Name of the Bridge Town project.')]Yes
pathAnnotated[str, Field(description='Project-relative path of the existing file to overwrite.')]Yes
contentAnnotated[str, Field(description="New file content as a UTF-8 string (when encoding='text') or base64-encoded bytes (when encoding='base64').")]Yes
encodingAnnotated[Literal['text', 'base64'], Field(description="Encoding of the content field: 'text' for UTF-8 source (default); 'base64' for binary files. 'auto' is not allowed on writes.")]No'text'
commit_messageAnnotated[str, Field(description='Git commit message. If omitted, the server generates a default message.')]No''
branch`Annotated[strNone, Field(description=“Branch to operate on. Defaults to the project’s default branch when omitted or null.”)]`NoNone
expected_shaAnnotated[str, Field(description='Expected blob SHA-1 (40 hex chars) for optimistic concurrency control. If the file has been modified since you last read it, the call fails with a conflict error. Read the file first to get its current sha.')]No''

Returns a structured object. Top-level fields:

  • path (string)
  • project (string)
  • commit_sha (string)

See the response example below for the full payload shape.

{
"name": "update_file",
"arguments": {
"project_name": "forecasts",
"path": "model/revenue.py",
"content": "def run(inputs):\n return {\"revenue\": 1000}\n",
"commit_message": "refactor: simplify revenue model",
"expected_sha": "0123456789abcdef0123456789abcdef01234567"
}
}
{
"path": "model/revenue.py",
"project": "forecasts",
"commit_sha": "abc1234def5678901234567890abcdef12345678"
}
  • Module: Models
  • Requires authentication via API token or Auth0 JWT.