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. Passing the branch name explicitly is equivalent. encoding must be ‘text’ for UTF-8 source files or ‘base64’ for binary files; encoding=‘auto’ is not allowed on writes. If commit_message is omitted the server generates a default of the form ‘feat: add {filename} (Bridge Town)’. Supply a descriptive commit_message for clearer project history. Requires at least Editor access to the project. Returns: path (str) — committed file path; project (str) — project name; commit_sha (str) — git commit SHA of the change.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
project_name | str | Yes | — | |
path | str | Yes | — | |
content | str | Yes | — | |
encoding | str | No | 'text' | |
commit_message | str | No | '' | |
branch | `str | None` | 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.