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.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
project_name | Annotated[str, Field(description='Name of the Bridge Town project.')] | Yes | — | |
path | Annotated[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 | — | |
content | Annotated[str, Field(description="File content as a UTF-8 string (when encoding='text') or base64-encoded bytes (when encoding='base64').")] | Yes | — | |
encoding | Annotated[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_message | Annotated[str, Field(description='Git commit message. If omitted, the server generates a default message.')] | No | '' | |
branch | `Annotated[str | None, Field(description=“Branch to operate on. Defaults to the project’s default branch when omitted or null.”)]` | No | None |
Returns
Section titled “Returns”Returns a structured object. Top-level fields:
path(string)project(string)commit_sha(string)
See the response example below for the full payload shape.
Example
Section titled “Example”Tool Call
Section titled “Tool Call”{ "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" }}Response
Section titled “Response”{ "path": "model/revenue.py", "project": "forecasts", "commit_sha": "abc1234def5678901234567890abcdef12345678"}- Module:
Models - Requires authentication via API token or Auth0 JWT.