Skip to content

update_file

Overwrite an existing file in a Bridge Town model and commit the change. The path is model-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
model_nameAnnotated[str, Field(description='Name of the Bridge Town model.')]Yes
pathAnnotated[str, Field(description='Model-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 model’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)
  • model (string)
  • commit_sha (string)

See the response example below for the full payload shape.

{
"name": "update_file",
"arguments": {
"model_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",
"model": "forecasts",
"commit_sha": "abc1234def5678901234567890abcdef12345678"
}
  • Module: Files
  • Requires authentication via API token or Auth0 JWT.