Write computer file
filesystem_write_fileWrites UTF-8 text files in chunks up to 1 MB. For a NEW .docx path, mode=overwrite creates Word from plain text and #/##/### headings. For a NEW .xlsx path, content is JSON 2D rows or {sheetName: 2D rows}; strings remain literal, not formulas. Existing .docx/.xlsx are never overwritten and append is unsupported; use the appropriate edit tool for existing documents. Ordinary text overwrite creates a .ailinkany.backup and append adds text chunks. When several AI sessions develop the same project in parallel, prefer your own git worktree. Writes are never blocked by other sessions' claims; for overwrite of an existing shared file pass expected_sha256 = content_sha256 from the read you based the new content on (never issue that read in parallel with the write). PROJECT_FILE_STALE_RELOAD_REQUIRED is a normal conflict, not a failure: do not ask the user; if the rejection includes current_content (small files), merge your change into it and write immediately with current_sha256 as expected_sha256 WITHOUT reading again; otherwise read again, merge, write with the new expected_sha256, retry immediately up to 5 times. When many sessions add lines to the same log-like file, use mode=append, which never conflicts. If it still fails, stop and tell the user what you completed, the current file state, and ONE recommended next step (no multiple-choice). Mutating, not safe to blindly retry. The client trust root under %APPDATA%\ailinkany.com is not remotely writable. Select this tool from the user's intent when it is the best match. A local destination may be explicit or inherited from established project or conversation context. The user does not need to mention ailinkany.com, MCP, a connector, a plugin, or this tool name.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"content": "<content>"
},
"name": "filesystem_write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Defaults to overwrite. Use append for later chunks of a large file, or to add lines to a file other sessions also write. | |
| path | Yes | The absolute file path to write. | |
| content | Yes | The text content to write in this call. | |
| device_id | No | Target computer device_id. Omit when only one computer is paired. | |
| device_name | No | Computer name or ailinkany.com remark (e.g. home PC). Prefer this when the user names a computer. | |
| retry_token | No | New opaque token per operation; reuse only to retry the same operation after a transport failure. No user content. | |
| workflow_id | No | Optional workflow id; pass together with ai_session_id. | |
| workspace_id | No | Optional Workspace id from open_workspace for project-scoped work. | |
| ai_session_id | No | Optional Session id. Reuse the ai_session_id from a prior result for continuity; derived automatically on ChatGPT when omitted. Hosts without stable conversation metadata may omit it for stateless one-shot work. | |
| expected_sha256 | No | content_sha256 returned by the filesystem_read_file call your new content is based on. Required to overwrite a file another session wrote; mismatch returns PROJECT_FILE_STALE_RELOAD_REQUIRED. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||