Skip to content

create_file

Create a new file in a Bridge Town project and commit it. The path is project-relative (e.g. ‘README.md’, ‘model/revenue.py’, ‘data/seed.csv’, ‘assets/logo.png’). Specify branch to commit to a non-default branch (e.g. a scenario branch). Omitting branch, passing an empty string, or passing null all resolve to the project’s default branch.

NameTypeRequiredDefaultDescription
project_nameAnnotated[str, Field(description='Name of the Bridge Town project.')]Yes
pathAnnotated[str, Field(description="Project-relative path for the new file (e.g. 'model/revenue.py', 'data/seed.csv'). Must not contain '..' or absolute path components.")]Yes
contentAnnotated[str, Field(description="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

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": "create_file",
"arguments": {
"project_name": "forecasts",
"path": "model/revenue.py",
"content": "import pandas as pd\n\ndef run(inputs):\n df = pd.DataFrame({\"month\": [1, 2, 3], \"revenue\": [100, 110, 121]})\n return {\"revenue\": df.to_dict(orient=\"records\")}\n",
"commit_message": "feat: add revenue model"
}
}
{
"path": "model/revenue.py",
"project": "forecasts",
"commit_sha": "abc1234def5678901234567890abcdef12345678"
}
  • Module: Models
  • Requires authentication via API token or Auth0 JWT.