{"at":"2026-11-23T00:57:58.716Z","dir":"sent","era":"server_discover","message":{"id":1,"jsonrpc":"2.0","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"didrun-lab","version":"0.1.0"},"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}}
{"at":"2026-11-23T00:57:59.222Z","dir":"received","era":"server_discover","message":{"error":{"code":-32601,"message":"Method not found"},"id":1,"jsonrpc":"2.0"}}
{"at":"2026-11-23T00:57:59.323Z","dir":"sent","era":"initialize","message":{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"didrun-lab","version":"0.1.0"},"protocolVersion":"2025-11-25"}}}
{"at":"2026-11-23T00:57:59.832Z","dir":"received","era":"initialize","message":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"tools":{}},"protocolVersion":"2025-11-25","serverInfo":{"name":"safe-docx","version":"0.2.0"}}}}
{"at":"2026-11-23T00:57:59.832Z","dir":"sent","era":"initialize","message":{"jsonrpc":"2.0","method":"notifications/initialized"}}
{"at":"2026-11-23T00:57:59.832Z","dir":"sent","era":"initialize","message":{"id":2,"jsonrpc":"2.0","method":"tools/list","params":{}}}
{"at":"2026-11-23T00:57:59.835Z","dir":"received","era":"initialize","message":{"id":2,"jsonrpc":"2.0","result":{"tools":[{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Read document content (DOCX, ODT, or Google Doc). Output is token-limited (~14k tokens) by default with pagination metadata (has_more, next_offset). Use offset/limit to paginate.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"comment_rendering":{"description":"How to render comments in read_file output. Use \"paragraph_notes\" (default) for paragraph-local comment threads, \"inline_markers\" to add `[cm-start:N]`/`[cm-end:N]` milestones in TOON output (combined with the thread blocks), \"endnotes\" to collect threaded comments into a trailing #COMMENTS block in TOON output, or \"none\" for the legacy output with no comment rendering.","enum":["none","paragraph_notes","endnotes","inline_markers"],"type":"string"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"format":{"enum":["toon","json","simple"],"type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"},"include_fingerprint":{"description":"When true and format=\"json\", include a portable content_fingerprint (\"sha256:nfkc:<16hex>\") on each paragraph. Read-only metadata derived from the paragraph's normalized visible text; NOT an edit anchor. Edit tools accept a `_bk_*` ID, or (DOCX only) any other bookmark name whose w:id-paired range covers exactly that one paragraph. No effect on TOON/simple output. Ignored for Google Docs and ODT.","type":"boolean"},"include_fingerprint_ordinal":{"description":"When true together with include_fingerprint and format=\"json\", add duplicate-disambiguation metadata to each paragraph: `content_fingerprint_ordinal` (1-based document-order position among paragraphs sharing the same content_fingerprint), `content_fingerprint_count_in_document` (total paragraphs sharing it, document-wide even under pagination), and `portable_paragraph_ref` (\"<content_fingerprint>#<ordinal>\"). Read-only disambiguator, NOT an edit anchor; reordering duplicates may change ordinals. No effect without include_fingerprint, and no effect on TOON/simple output. Ignored for Google Docs and ODT. Default: false.","type":"boolean"},"include_footnotes":{"description":"Single-call body + footnotes retrieval. When true and format=\"json\", the response gains a document-wide TOP-LEVEL `footnotes` array — each entry is {id, display_number, ref_paragraph_ids (an ARRAY of the paragraph ids that reference it), paragraphs[] ({text, tagged_text with run-level formatting tags, style})} — preserving multi-paragraph bodies and footnote-internal bold/italic/citation formatting. This top-level array is NOT inlined into content[], so the 1:1 content[] index invariant is preserved. For backward compatibility a lightweight per-node `footnotes` array ({id, display_number, text}) is ALSO attached to each paragraph node it anchors, windowed to the returned slice. When true and format=\"toon\", a trailing `#FOOTNOTES` sidecar block is appended (symmetric with `#COMMENTS`). Footnotes with an empty body or display_number 0 are excluded. No effect on simple output. Ignored for Google Docs and ODT. Default: false.","type":"boolean"},"limit":{"description":"Max paragraphs to return. When omitted, output is token-limited to ~14k tokens with pagination.","type":"number"},"node_ids":{"description":"Paragraph selectors. Each accepts a safe-docx `_bk_*` id, or (DOCX only) any other bookmark name — e.g. a host application's own stable paragraph bookmark — whose w:id-paired range covers exactly one paragraph. Exact name match; a point bookmark or a multi-paragraph range is refused. Returned rows always report the paragraph's canonical `_bk_*` id, even when selected by another bookmark name; results are de-duplicated and returned in document order.","items":{"type":"string"},"type":"array"},"offset":{"description":"1-based paragraph offset for pagination. Negative values count from end.","type":"number"},"show_formatting":{"description":"When true (default), shows inline formatting tags (<b>, <i>, <u>, <highlighting>, <a>). When false, emits plain text with no inline tags.","type":"boolean"}},"type":"object"},"name":"read_file","surface":"internal"},{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Get a compact structural map of a document's headings (DOCX only). Each entry is `{paragraph_id, text, level, source}`, plus `list_label` (e.g. \"Section 1.01\") when the heading is numbered; Markdown puts the label before the text. Deterministic sources are `word_style`, `list_metadata`, and `outline_level`, selected in that precedence order and included by default. Heuristic sources are `run_in_header`, `title_with_period`, `title_with_colon`, `title_caps_centered`, and `title_bare`; set include_heuristic_headings=true to include them. JSON preserves levels 1-9; Markdown clamps visual ATX depth to 6. Read-only.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX file.","type":"string"},"format":{"description":"Output format: 'json' (default, structured outline array) or 'markdown' (indented ATX outline under `content`).","enum":["json","markdown"],"type":"string"},"include_heuristic_headings":{"description":"When true, also include heuristic title/run-in/centered-caps headings alongside deterministic word_style, list_metadata, and outline_level headings. Default: false (all deterministic sources only).","type":"boolean"}},"type":"object"},"name":"get_document_outline","surface":"internal"},{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Read DOCX main-document sections in document order. Returns zero-based session-relative section_index values, paragraph/body boundary metadata, page numbering, page size, margins, and header/footer relationship references. Call again after any operation that changes section topology. Read-only.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"}},"type":"object"},"name":"get_sections","surface":"internal"},{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Search paragraphs with regex. Use file_path for session-based search, file_paths for stateless multi-file search, or google_doc_id for Google Docs. ODT supported via file_path (single-file) only.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"case_sensitive":{"type":"boolean"},"context_chars":{"type":"number"},"dedupe_by_paragraph":{"type":"boolean"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"file_paths":{"description":"Multiple file paths for stateless multi-file search. No session created.","items":{"type":"string"},"type":"array"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"},"include_context":{"description":"When false, skip document view context (list labels, headers) for faster results. Default: true.","type":"boolean"},"max_results":{"type":"number"},"pattern":{"type":"string"},"patterns":{"items":{"type":"string"},"type":"array"},"search_xml":{"description":"When true, search raw XML (word/document.xml) instead of paragraph text.","type":"boolean"},"whole_word":{"type":"boolean"}},"type":"object"},"name":"grep","surface":"internal"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Single-agent front door for applying multiple edit steps (replace_text, insert_paragraph) to a document in one call. Validates all steps first, rejects conflicts before applying anything, then executes valid steps sequentially. Two source-proven bonded heading/body insertions may share an anchor and position when both declare the same bonded_pair_id and distinct style_source_id values; unrelated same-slot inserts remain conflicts. Accepts inline steps or a plan_file_path JSON array. Surface: revisionable — every applied step emits native OOXML tracked changes.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"plan_file_path":{"description":"Path to a .json file containing an array of edit steps. Mutually exclusive with steps.","type":"string"},"steps":{"description":"JSON array of edit steps. Each step needs step_id, operation, and operation-specific fields.","items":{"additionalProperties":{},"properties":{},"type":"object"},"type":"array"}},"required":["file_path"],"type":"object"},"name":"batch_edit","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Replace text in a paragraph by provider paragraph id, preserving formatting where supported. Supports DOCX, ODT, and Google Docs. To delete an ordinary DOCX body paragraph, pass its complete visible text as old_string and an empty new_string; a clean save removes the paragraph and a tracked save keeps the deletion for review. Do not use this shortcut for paragraphs that carry section properties, are structurally required by a table cell, or own bookmark/comment anchors without inspecting the structure first. Surface: revisionable — DOCX edits emit native OOXML tracked changes (w:ins/w:del/w:rPrChange).","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"},"instruction":{"type":"string"},"new_string":{"type":"string"},"normalize_first":{"description":"Merge format-identical adjacent runs before searching. Useful when text is fragmented across runs.","type":"boolean"},"old_string":{"type":"string"},"target_paragraph_id":{"description":"Paragraph anchor. Accepts a safe-docx `_bk_*` id, or (DOCX only) any other bookmark name — e.g. a host application's own stable paragraph bookmark — whose w:id-paired range covers exactly this one paragraph. Exact name match; a point bookmark or a multi-paragraph range is refused.","type":"string"}},"required":["target_paragraph_id","old_string","new_string","instruction"],"type":"object"},"name":"replace_text","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Insert a paragraph before/after an anchor paragraph by paragraph id. DOCX responses include structural_warnings when the placement may slice a hierarchy, mismatch list levels, or renumber a list. Supports DOCX, ODT, and Google Docs. ODT paragraph ids remain stable within the session; new paragraphs receive monotonically allocated ids, and reopening renumbers stored document order. Surface: revisionable — DOCX insertions emit native OOXML tracked changes.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"},"instruction":{"type":"string"},"new_string":{"type":"string"},"position":{"enum":["BEFORE","AFTER"],"type":"string"},"positional_anchor_node_id":{"description":"Anchor paragraph. Accepts a safe-docx `_bk_*` id, or (DOCX only) any other bookmark name — e.g. a host application's own stable paragraph bookmark — whose w:id-paired range covers exactly this one paragraph. Exact name match; a point bookmark or a multi-paragraph range is refused.","type":"string"},"style_source_id":{"description":"Paragraph anchor to clone formatting (pPr and template run) from instead of the positional anchor. Accepts a `_bk_*` ID, or (DOCX only) any other bookmark name whose w:id-paired range covers exactly that one paragraph. Falls back to anchor with a warning if not found.","type":"string"}},"required":["positional_anchor_node_id","new_string","instruction"],"type":"object"},"name":"insert_paragraph","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Persist the current in-memory document session. For DOCX: saves clean and/or tracked changes output. For ODT: saves an .odt package. For Google Docs: checkpoint (default) returns revisionId, or snapshot exports as DOCX. Surface: revisionable — the save report lists both the AI revisions applied and a non-revision change manifest of any package-level mutations (comment/footnote side parts, relationships) that have no tracked-change wrapper.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"allow_discard_preserved_revisions":{"description":"Explicitly allow a clean artifact to auto-accept remaining revisions by the session AI author after accept_ai_edits/reject_ai_edits selectively left revisions unresolved. Default: false.","type":"boolean"},"allow_overwrite":{"type":"boolean"},"clean_bookmarks":{"description":"Controls removal of internal bookmarks from DOCX output. Behavior is intentionally three-way: OMIT (recommended for tracked/persistence saves) preserves the document's own bookmarks — only safe-docx paragraph anchors (`_bk_*`) are removed. Explicit `true` ALSO strips harness edit-span bookmarks (`edit-*`) to produce a clean deliverable; do NOT pass it when the tracked output feeds a redline pipeline, because that reproduces the pre-#609 loss of `edit-*` anchors. `false` keeps all bookmarks. Omitting is NOT equivalent to passing `true` — they differ precisely in whether original `edit-*` bookmarks survive.","type":"boolean"},"fail_on_rebuild_fallback":{"description":"Deprecated and ignored (#126). The default save no longer runs the comparison reconstruction engine, so there is no rebuild fallback to guard against; accepted for backward compatibility only.","type":"boolean"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"},"save_format":{"enum":["clean","tracked","both"],"type":"string"},"save_to_local_path":{"type":"string"},"tracked_changes_author":{"type":"string"},"tracked_changes_engine":{"description":"Deprecated and ignored (#126). The redline is now the session's write-time tracked markup, serialized directly — there is no comparison engine to select. Use the compare_documents tool for comparison-based redlines.","enum":["auto","atomizer"],"type":"string"},"tracked_save_to_local_path":{"type":"string"}},"required":["save_to_local_path"],"type":"object"},"name":"save","surface":"revisionable"},{"annotations":{"destructiveHint":false,"readOnlyHint":false},"description":"Export a document to a portable rendering (Markdown, semantic HTML, or plain text). Writes an output file (default: source path with the format extension, e.g. .md, .html, or .txt) and returns its path, byte count, and the rendered content (under `content`). Intentionally lossy (no round-trip); HTML is the semantic tier, not pixel-faithful. DOCX only — Google Docs is not supported.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"allow_overwrite":{"description":"Overwrite output_path if it already exists. Default: false.","type":"boolean"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"format":{"description":"Output format: 'markdown' (default, writes .md), 'html' (writes .html), or 'plaintext' (writes .txt).","enum":["markdown","html","plaintext"],"type":"string"},"include_markdown":{"description":"Include the rendered content (under `content`) in the response. Default: true; set false for large documents.","type":"boolean"},"output_path":{"description":"Where to write the rendering. Defaults to the source path with the format extension.","type":"string"}},"type":"object"},"name":"export","surface":"internal"},{"annotations":{"destructiveHint":false,"readOnlyHint":false},"description":"Convert a DOCX document to OpenDocument Text (.odt) using the native model-to-model converter (no LibreOffice involved). Writes the .odt (default: source path with the .odt extension), validates ODF packaging safety before writing, and returns the output path plus a `lossiness` summary itemizing every downgraded construct. Conversion is semantic and intentionally lossy: text, headings, bold/italic/underline, hyperlinks, lists, and tables are mapped; richer styling, tracked changes, comments, and headers/footers are not. DOCX in, ODT out — Google Docs and .odt inputs are not supported.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"allow_overwrite":{"description":"Overwrite output_path if it already exists. Default: false.","type":"boolean"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"output_path":{"description":"Where to write the .odt. Defaults to the source path with the .odt extension.","type":"string"}},"type":"object"},"name":"convert_to_odt","surface":"internal"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Apply layout controls (paragraph spacing, paragraph alignment and pagination flags, table row height, cell padding). paragraph_properties sets alignment (w:jc) and sets (true) or removes (false) direct pageBreakBefore/keepNext/keepLines; requests that change nothing are no-ops. Google Docs supports paragraph spacing only. Surface: revisionable — DOCX geometry edits emit native property-change revisions (w:pPrChange/w:trPrChange/w:tcPrChange).","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"cell_padding":{"additionalProperties":false,"properties":{"bottom_dxa":{"type":"number"},"cell_indexes":{"items":{"type":"number"},"type":"array"},"left_dxa":{"type":"number"},"right_dxa":{"type":"number"},"row_indexes":{"items":{"type":"number"},"type":"array"},"table_indexes":{"items":{"type":"number"},"type":"array"},"top_dxa":{"type":"number"}},"type":"object"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"},"paragraph_properties":{"additionalProperties":false,"properties":{"alignment":{"enum":["left","center","right","both"],"type":"string"},"keep_lines":{"type":"boolean"},"keep_next":{"type":"boolean"},"page_break_before":{"type":"boolean"},"paragraph_ids":{"items":{"type":"string"},"type":"array"}},"type":"object"},"paragraph_spacing":{"additionalProperties":false,"properties":{"after_twips":{"type":"number"},"before_twips":{"type":"number"},"line_rule":{"enum":["auto","exact","atLeast"],"type":"string"},"line_twips":{"type":"number"},"paragraph_ids":{"items":{"type":"string"},"type":"array"}},"type":"object"},"row_height":{"additionalProperties":false,"properties":{"row_indexes":{"items":{"type":"number"},"type":"array"},"rule":{"enum":["auto","exact","atLeast"],"type":"string"},"table_indexes":{"items":{"type":"number"},"type":"array"},"value_twips":{"type":"number"}},"type":"object"},"strict":{"type":"boolean"}},"type":"object"},"name":"format_layout","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Change one DOCX body paragraph’s direct numbering reference. Use remove=true to drop direct w:numPr, match_paragraph_id to adopt another paragraph’s explicit numbering, or num_id with ilvl to reference an existing numbering definition. This tool does not create numbering definitions or change style-inherited numbering. Effective edits emit a native w:pPrChange; identical requests are no-ops.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"},"ilvl":{"description":"Existing numbering level for num_id; requires num_id.","maximum":9007199254740991,"minimum":0,"type":"integer"},"match_paragraph_id":{"description":"Copy this paragraph’s complete direct num_id and ilvl to the target.","type":"string"},"num_id":{"description":"Existing positive decimal w:numId from this DOCX; requires ilvl.","type":"string"},"remove":{"description":"Set true to remove the target paragraph’s direct w:numPr.","type":"boolean"},"target_paragraph_id":{"description":"Target paragraph anchor returned by read_file.","type":"string"}},"required":["target_paragraph_id"],"type":"object"},"name":"format_numbering","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Partially update one DOCX section’s page-number restart, page dimensions/orientation, or margins using a zero-based section_index from get_sections. Effective calls emit one native w:sectPrChange and preserve section topology, page-number format, columns, break type, and header/footer references. Orientation is literal and does not automatically swap dimensions. This tool does not create sections or edit header/footer content.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"},"margins":{"additionalProperties":false,"description":"Partial margin update in twips. All seven values are required when w:pgMar is absent.","properties":{"bottom_twips":{"maximum":9007199254740991,"minimum":-9007199254740991,"type":"integer"},"footer_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"gutter_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"header_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"left_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"right_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"top_twips":{"maximum":9007199254740991,"minimum":-9007199254740991,"type":"integer"}},"type":"object"},"page_number_start":{"description":"Non-negative page number at which this section starts.","maximum":9007199254740991,"minimum":0,"type":"integer"},"page_size":{"additionalProperties":false,"description":"Partial page-size update. Both dimensions are required when w:pgSz is absent.","properties":{"height_twips":{"description":"Positive page height in twentieths of a point.","exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"},"orientation":{"description":"Literal OOXML orientation; dimensions are not auto-swapped.","enum":["portrait","landscape"],"type":"string"},"width_twips":{"description":"Positive page width in twentieths of a point.","exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"}},"type":"object"},"section_index":{"description":"Zero-based session-relative index returned by get_sections.","maximum":9007199254740991,"minimum":0,"type":"integer"}},"required":["section_index"],"type":"object"},"name":"format_section","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Insert a tracked DOCX section break after a stable direct-body paragraph. The new boundary preserves the containing section’s page setup and header/footer relationship references. The following section inherits current properties by default; set inherit_properties=false to reset non-relationship properties, and optionally provide page-number/page-size/margin overrides in new_section. Call get_sections again after success because section indexes change.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"break_type":{"description":"OOXML start behavior for the following section.","enum":["nextPage","nextColumn","continuous","evenPage","oddPage"],"type":"string"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"inherit_properties":{"description":"Whether the following section retains current non-relationship properties. Default: true. Header/footer references are always preserved.","type":"boolean"},"new_section":{"additionalProperties":false,"description":"Optional page-number and page-setup overrides for the following section. Complete page size/margins are required when reset removes those elements.","properties":{"margins":{"additionalProperties":false,"properties":{"bottom_twips":{"maximum":9007199254740991,"minimum":-9007199254740991,"type":"integer"},"footer_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"gutter_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"header_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"left_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"right_twips":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"top_twips":{"maximum":9007199254740991,"minimum":-9007199254740991,"type":"integer"}},"type":"object"},"page_number_start":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"page_size":{"additionalProperties":false,"properties":{"height_twips":{"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"},"orientation":{"enum":["portrait","landscape"],"type":"string"},"width_twips":{"exclusiveMinimum":0,"maximum":9007199254740991,"type":"integer"}},"type":"object"}},"type":"object"},"paragraph_id":{"description":"Stable paragraph id returned by read_file; must identify a direct main-body paragraph that does not already end a section.","minLength":1,"type":"string"}},"required":["paragraph_id","break_type"],"type":"object"},"name":"insert_section_break","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Accept every supported tracked change in the document body, including inserted and deleted table-row revisions. Returns acceptance stats; unresolvedRowRevisions remains 0 for supported row markers.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"}},"required":["file_path"],"type":"object"},"name":"accept_changes","surface":"internal"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Selectively accept tracked changes by revision id or author in the in-memory session, leaving all other (e.g. third-party reviewer) revisions byte-untouched. This does not write file_path; call save to persist the mutation. Provide revision_ids (array of w:id values) to target specific revisions, or author to accept every revision by one actor. Sweeps document.xml and supported side-story parts (footnotes, endnotes, comments). An ambiguous overlap — a targeted revision structurally containing, or contained by, a non-targeted revision (nested ins/del/move) — hard-errors with code AMBIGUOUS_REVISION_OVERLAP and a structured `overlaps` list unless normalize_first is set (best-effort, no byte-identical promise).","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"author":{"description":"Accept every revision authored by this w:author. Convenience alternative to revision_ids.","type":"string"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"normalize_first":{"description":"Attempt best-effort resolution on an ambiguous (overlapping) revision graph instead of hard-erroring. No byte-identical guarantee. Default: false.","type":"boolean"},"revision_ids":{"description":"w:id values of the revisions to accept. Mutually preferred over author.","items":{"type":["string","number"]},"type":"array"}},"required":["file_path"],"type":"object"},"name":"accept_ai_edits","surface":"internal"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Selectively reject tracked changes by revision id or author in the in-memory session (restoring their pre-edit state), leaving all other revisions byte-untouched. This does not write file_path; call save to persist the mutation. Symmetric to accept_ai_edits: provide revision_ids or author, sweeps document.xml and supported side-story parts, and hard-errors on an ambiguous overlap (code AMBIGUOUS_REVISION_OVERLAP with a structured `overlaps` list) unless normalize_first is set.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"author":{"description":"Reject every revision authored by this w:author. Convenience alternative to revision_ids.","type":"string"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"normalize_first":{"description":"Attempt best-effort resolution on an ambiguous (overlapping) revision graph instead of hard-erroring. No byte-identical guarantee. Default: false.","type":"boolean"},"revision_ids":{"description":"w:id values of the revisions to reject. Mutually preferred over author.","items":{"type":["string","number"]},"type":"array"}},"required":["file_path"],"type":"object"},"name":"reject_ai_edits","surface":"internal"},{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Check whether the document body contains tracked-change markers (insertions, deletions, moves, and property-change records). Read-only.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"}},"required":["file_path"],"type":"object"},"name":"has_tracked_changes","surface":"internal"},{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Get file/session metadata including edit count, normalization stats, and cache info. Supports DOCX, ODT, and Google Docs.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"}},"type":"object"},"name":"get_file_status","surface":"internal"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Close an open file session, or close all sessions with explicit confirmation. Supports DOCX, ODT, and Google Docs.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"clear_all":{"type":"boolean"},"confirm":{"type":"boolean"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"google_doc_id":{"description":"Google Doc ID or URL (alternative to file_path). Extract from URL: docs.google.com/document/d/{ID}/edit","type":"string"}},"type":"object"},"name":"close_file","surface":"internal"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Add a comment or threaded reply to a document. Provide target_paragraph_id + anchor_text for root comments, or parent_comment_id for replies. Supports DOCX and ODT (ODT backs comments with office:annotation; threaded replies are DOCX-only). Surface: revisionable + package-mutation — the body-story comment reference is tracked (w:ins), while comment text and author metadata are recorded in the save report non-revision change manifest.","emitsNonRevisionChanges":true,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"anchor_text":{"description":"Text within the paragraph to anchor the comment to. If omitted, anchors to entire paragraph.","type":"string"},"author":{"description":"Comment author name.","type":"string"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"initials":{"description":"Author initials (defaults to first letter of author name).","type":"string"},"parent_comment_id":{"description":"Parent comment ID for threaded replies.","type":"number"},"target_paragraph_id":{"description":"Paragraph ID to anchor the comment to (for root comments).","type":"string"},"text":{"description":"Comment body text.","type":"string"}},"required":["file_path","author","text"],"type":"object"},"name":"add_comment","surface":"revisionable"},{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Get all comments from the document with IDs, authors, dates, text, and anchored paragraph IDs. Range-anchored DOCX comments also expose optional end_paragraph_id, start_run_index, start_char_offset, end_run_index, and end_char_offset fields describing the covered span. Includes threaded replies (DOCX). Supports DOCX and ODT. Read-only.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"}},"required":["file_path"],"type":"object"},"name":"get_comments","surface":"internal"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Delete a comment and all its threaded replies from the document. Cascade-deletes all descendants. Surface: revisionable + package-mutation — the body-story comment reference removal is tracked (w:del), while comment/reply text cleanup is recorded in the save report non-revision change manifest.","emitsNonRevisionChanges":true,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"comment_id":{"description":"Comment ID to delete.","type":"number"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"}},"required":["file_path","comment_id"],"type":"object"},"name":"delete_comment","surface":"revisionable"},{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Compare two documents and produce a tracked-changes output document. Provide original_file_path + revised_file_path for standalone comparison, or file_path to compare session edits against the original. DOCX and ODF (.odt) support both modes. DOCX output always uses the revised archive as its package base and publishes tagged revisions; engine, strategy, reconstruction, premerge, and refinement selectors are not exposed. DOCX stats count insertions/deletions as contiguous ranges, expose tagged-token-v1 totals as insertedAtoms/deletedAtoms with atomMetricVersion, report formatChanges separately from modifiedParagraphs, and report detected moves as moves/movedParagraphs with moveFromRanges/moveToRanges (moved content is not also counted as insertions or deletions, so a pure move reports moves > 0 with zero insertions/deletions). When a DOCX input difference is preserved in the output without tracked-change markup (for example a removed section's header or footer, or an unsupported header/footer topology), the response includes `unrepresented_changes` (objects with scope, kind, sectionIndex, for header/footer scopes role, and for the contentControl scope a contentControl identity: a changed `w:sdtPr`/`w:sdtEndPr` is published as the revised properties without markup, because CT_SdtPr admits no revision elements) plus one `warnings` string per entry, and the message carries a WARNING. Both fields are absent when no reportable unrepresented change was detected; the detector covers section properties, selected header/footer stories and content-control properties, so absence is not a guarantee about differences outside that scope. ODF compares at inline granularity (a modified paragraph is marked up in place — only the changed spans are struck or inserted).","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"author":{"description":"Author name for track changes. Default: 'Comparison' (DOCX) or the configured AI author (ODF).","type":"string"},"compare_moves":{"description":"Detect moved content (DOCX only). Default: true.","type":"boolean"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"ignore_formatting":{"description":"Ignore formatting differences (DOCX only). Default: false.","type":"boolean"},"original_file_path":{"description":"Path to the original DOCX or .odt file.","type":"string"},"revised_file_path":{"description":"Path to the revised DOCX or .odt file.","type":"string"},"revision_grouping":{"description":"How DOCX revisions are grouped. 'readable-semantic' (default) shows each rewritten passage as one deletion followed by one insertion, absorbing short unchanged words, spaces and punctuation between changes; runs keep their own formatting, and moves, fields, bookmarks, comment ranges and note references are never absorbed. 'token-minimal' emits the smallest word-level deletion/insertion set, which alternates word by word in heavily rewritten paragraphs. Accept All and Reject All results are the same either way. DOCX only.","enum":["readable-semantic","token-minimal"],"type":"string"},"save_to_local_path":{"description":"Path to save the tracked-changes output (DOCX or .odt).","type":"string"}},"required":["save_to_local_path"],"type":"object"},"name":"compare_documents","surface":"revisionable"},{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Get all footnotes from the document with IDs, display numbers, text, and anchored paragraph IDs. Read-only.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"}},"required":["file_path"],"type":"object"},"name":"get_footnotes","surface":"internal"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Add a footnote anchored to a paragraph. Optionally position the reference after specific text using after_text. Note: [^N] markers in read_file output are display-only and not part of the editable text used by replace_text. Surface: revisionable + package-mutation — the footnote reference and note text are tracked (w:ins), while footnote-part creation and registration are recorded in the save report non-revision change manifest.","emitsNonRevisionChanges":true,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"after_text":{"description":"Text after which to insert the footnote reference. If omitted, appends at end of paragraph.","type":"string"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"target_paragraph_id":{"description":"Paragraph ID to anchor the footnote to.","type":"string"},"text":{"description":"Footnote body text.","type":"string"}},"required":["file_path","target_paragraph_id","text"],"type":"object"},"name":"add_footnote","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Update the text content of an existing footnote. Surface: revisionable — note-text changes emit native OOXML tracked changes (w:ins/w:del) inside the footnote body.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"new_text":{"description":"New footnote body text.","type":"string"},"note_id":{"description":"Footnote ID to update.","type":"number"}},"required":["file_path","note_id","new_text"],"type":"object"},"name":"update_footnote","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Delete a footnote and its reference from the document. Surface: revisionable — the reference and note text are removed as native OOXML tracked deletions (w:del).","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"note_id":{"description":"Footnote ID to delete.","type":"number"}},"required":["file_path","note_id"],"type":"object"},"name":"delete_footnote","surface":"revisionable"},{"annotations":{"destructiveHint":true,"readOnlyHint":false},"description":"Clear specific run-level formatting (bold, italic, underline, highlight, color, font) from paragraphs. Surface: revisionable — clearing emits a native run-property-change revision (w:rPrChange).","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"clear_bold":{"description":"Remove bold formatting.","type":"boolean"},"clear_color":{"description":"Remove font color.","type":"boolean"},"clear_font":{"description":"Remove font family and size.","type":"boolean"},"clear_highlight":{"description":"Remove highlight formatting.","type":"boolean"},"clear_italic":{"description":"Remove italic formatting.","type":"boolean"},"clear_underline":{"description":"Remove underline formatting.","type":"boolean"},"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"paragraph_ids":{"description":"Paragraph IDs to clear formatting from. If omitted, clears from all paragraphs.","items":{"type":"string"},"type":"array"}},"required":["file_path"],"type":"object"},"name":"clear_formatting","surface":"revisionable"},{"annotations":{"destructiveHint":false,"readOnlyHint":true},"description":"Extract tracked changes as structured JSON with before/after text per paragraph, revision details, and comments. Table rows inserted or deleted as a whole, and row property changes (w:trPr > w:ins / w:del / w:trPrChange), are reported as records with scope \"row\", keyed by the row's first paragraph, whose revisions are ROW_INSERTION / ROW_DELETION / FORMAT_CHANGE entries carrying the revision id, author and date. Supports pagination via offset and limit. Read-only - does not modify the document.","emitsNonRevisionChanges":false,"inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"file_path":{"description":"Path to the DOCX or ODT file.","type":"string"},"limit":{"description":"Max entries per page (1-500). Default: 50.","type":"number"},"offset":{"description":"0-based offset for pagination. Default: 0.","type":"number"}},"required":["file_path"],"type":"object"},"name":"extract_revisions","surface":"internal"}]}}}
