files_write
Write a text file into the workspace.
Creates or replaces a file in /workspace with the text you give.
Inputs
| Name | Type | Default | Allowed values | Description |
|---|---|---|---|---|
sessionIdrequired | string | – | – | The session's id, from session_create. |
pathrequired | string | – | – | The file, relative to /workspace. |
contentrequired | string | – | – | The text to write. |
sessionId is the id that session_create returned. The server keeps no default session. If that session is stopped, this tool resumes it first, as it was (a resume starts a machine again, and billing with it).
Example call
This is what an MCP client sends. You do not write it yourself: ask the model in plain words and it calls the tool.
{ "name": "files_write", "arguments": { "sessionId": "6c1f3c9e-1d2a-4f67-9b0e-1b2c3d4e5f60", "path": "notes.md", "content": "# Findings\n" }}What it returns
How many bytes were written, and where.
Wrote 11 bytes to /workspace/notes.md.When a call fails, the result is marked as an error. Its text starts with the API’s error code, such as unauthorized or session_not_running, followed by its message.
Annotations
The server tells every client what this tool does to the world, so a client can decide what to ask you about before it runs.
| Annotation | Value |
|---|---|
title | Write a file |
readOnlyHint | false |
destructiveHint | true |
openWorldHint | false |
The same thing with the API
| Endpoint | Reference |
|---|---|
PUT /v1/sessions/{id}/files | Upload a file |
These docs describe a beta API. Endpoints, fields and SDK methods may change before general availability; breaking changes will be listed in the changelog.