Write a document in your member home
The job
Create a document in the member's own home, then change it safely, so that no change overwrites text that someone else changed after you read it.
Prerequisites
- The person who connected is a member. An admin or staff connection never gets
writeDocoreditDoc. - The connection holds
knowledge:readandknowledge:write. - The instance has home writing turned on. It is off by default, and the instance's operator turns it on.
writeDocandeditDocare in your tool list. If they are not, one of the conditions above is not true. See the document write tools.
There is no confirmation step, no history and no undo. A replacement discards the old text. Make each change only when the person asked for it.
Steps
If
writeDocandeditDocare not in your tool list, read thewritingsection of the guide before you tell the person anything:{ "section": "writing" }Find the member home. Call
listProjects:{}The member home is the project whose
kindismember-home, in this examplemember-14.Create the document. Call
writeDocwithoutexpectedVersion. Make a newoperationIdfor this change, for example a UUID.{ "operationId": "7c1e4b2a-9f3d-4e6a-8b10-5d2c7f9e0a41", "project": "member-14", "path": "notes/2026-10-02-client-call.md", "content": "# Client call, 2 October 2026\n\nThe client asked for the diagnostic at the standard price.\n", "reason": "Notes from the client call" }The result has
created: trueand the newversion. If the request times out, send it again with the sameoperationIdand the same arguments. The retry returns the first result and does not write twice.Before you change the document, read it. Keep the
versionfrom the result.{ "project": "member-14", "path": "notes/2026-10-02-client-call.md" }{ "path": "member-14/notes/2026-10-02-client-call.md", "content": "# Client call, 2 October 2026\n\nThe client asked for the diagnostic at the standard price.\n", "totalBytes": 90, "offset": 0, "bytesReturned": 90, "truncated": false, "version": "AQ-example-opaque-version" }Change one passage with
editDoc. Pass theversionfrom step 4 asexpectedVersion, and make a newoperationId.oldStringmust occur exactly once in the document.{ "operationId": "c4d8e2f1-6a3b-4c9d-9e07-1b5a8f2d6c30", "project": "member-14", "path": "notes/2026-10-02-client-call.md", "oldString": "at the standard price.", "newString": "at the standard price. A partner will confirm the start date by 9 October.", "expectedVersion": "AQ-example-opaque-version", "reason": "Add the agreed next step" }The result has
created: falseand a newversion. UsereadDocagain before the next change.
To replace a whole document, call writeDoc with the version from readDoc as expectedVersion. Use editDoc when you can: it changes the least.
What can go wrong
The full list of refusals is in the document write tools. The ones that this job meets most often:
version_conflict:stale_version: the document changed after your read. Read it again, decide whether your change still applies to the new text, and retry with the newversionand a newoperationId.version_conflict:target_exists: in step 3, a document already exists at that path. Read it, and replace it only if that is what the person wants.invalid_input:edit_no_matchorinvalid_input:edit_not_unique:oldStringdoes not occur in the document, or occurs more than once. Include more surrounding text.forbidden:home_writes_disabled: this instance has home writing turned off. Ask the operator, or write to a shared project where the person has awritegrant.idempotency_conflict:operation_id_reused: you used anoperationIdagain for a different change. Make a new one.MCP error -32602: Tool writeDoc not found: a condition in the prerequisites is not true. Read thewritingandpermissionssections of getDocs. Do not tell the person that Sasha cannot write.