{"version":"0.43.0","id":"kanvas.draft.edit","operationId":"kanvas.draft.edit","title":"draft edit","requiredInputs":["sessionId","displayId"],"description":"DRAFT EDIT: change the draft text in place with expectedRevision CAS and a stable requestId: replace a range, find-replace (occurrence or all), append or set-text; also draftStatus, purpose and focus. Untouched suggestions are re-anchored; suggestions an edit overlaps are dropped and reported. Concurrency: expectedRevision is OPTIONAL stale-write guard. Supplying a stale guard rejects the call; omitting optional guards does not waive authorization or other preconditions. After a conflict, inspect the operation-specific error and read current authorized state before retrying; current-value fields vary by operation.","guidance":"Edit the draft text in place (replace, find-replace, append or set-text). Also sets draftStatus, purpose and focus, with revision CAS and a stable requestId. Offsets refer to the text at expectedRevision; overlapped suggestions are dropped and reported.","inputSchema":{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"},"displayId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"},"expectedRevision":{"type":"integer","minimum":0,"maximum":9007199254740991},"requestId":{"description":"Stable ID deduplicates retries; omission creates a fresh ID per call.","type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"},"edits":{"description":"Non-overlapping; offsets refer to the text at expectedRevision.","minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"op":{"type":"string","enum":["replace","find-replace","append","set-text"]},"start":{"description":"replace: start offset.","type":"integer","minimum":0,"maximum":100000},"end":{"description":"replace: exclusive end (= start inserts).","type":"integer","minimum":0,"maximum":100000},"find":{"description":"find-replace: exact text.","type":"string","minLength":1,"maxLength":4000},"occurrence":{"description":"find-replace: which occurrence (default 1).","type":"integer","minimum":1,"maximum":10000},"all":{"description":"find-replace: every occurrence.","type":"boolean"},"text":{"description":"New text.","type":"string","maxLength":100000}},"required":["op"],"additionalProperties":false}},"draftStatus":{"type":"string","enum":["drafting","reviewing","ready"]},"purpose":{"description":"Short purpose hint; null removes it.","anyOf":[{"type":"string","minLength":1,"maxLength":160},{"type":"null"}]},"focus":{"description":"Highlighted passage after the edits; null clears it.","anyOf":[{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":100000},"end":{"type":"integer","minimum":0,"maximum":100000},"label":{"type":"string","maxLength":160}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]}},"required":["sessionId","displayId"],"additionalProperties":false,"examples":[{"sessionId":"session-id","displayId":"display-id","expectedRevision":3,"requestId":"draft-edit-1","edits":[{"op":"find-replace","find":"Dear team","text":"Hi all"}]},{"sessionId":"session-id","displayId":"display-id","expectedRevision":3,"requestId":"draft-edit-2","edits":[{"op":"append","text":"\n\nBest regards"}],"draftStatus":"reviewing"}]},"annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false},"examples":[{"tool":"kanvas_call","arguments":{"operationId":"kanvas.draft.edit","arguments":{"sessionId":"session-id","displayId":"display-id","expectedRevision":3,"requestId":"draft-edit-1","edits":[{"op":"find-replace","find":"Dear team","text":"Hi all"}]}}},{"tool":"kanvas_call","arguments":{"operationId":"kanvas.draft.edit","arguments":{"sessionId":"session-id","displayId":"display-id","expectedRevision":3,"requestId":"draft-edit-2","edits":[{"op":"append","text":"\n\nBest regards"}],"draftStatus":"reviewing"}}}],"exampleNotice":"Examples are valid syntax with illustrative IDs and source data. Substitute live authorized IDs/revisions; examples never grant consent."}