@superdoc-dev/sdk 1.3.0-next.8 → 1.3.0-next.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  "tools": [
4
4
  {
5
5
  "name": "superdoc_get_content",
6
- "description": "Read document content. Use action \"info\" for structure and styles, \"blocks\" for all block IDs and types, \"text\" or \"markdown\" for content. Call info or blocks before editing.",
6
+ "description": "Read document content in various formats. Call this first in any workflow to understand document structure before making edits. Action \"blocks\" returns structured block data with nodeId, nodeType, textPreview, formatting properties (fontFamily, fontSize, color, bold, underline, alignment), and ref handles for immediate use with superdoc_edit or superdoc_format. Action \"text\" and \"markdown\" return the full document as plain text or Markdown. Action \"html\" returns HTML. Action \"info\" returns document metadata: word count, paragraph count, page count, outline, available styles, and capability flags. The \"blocks\" action supports pagination via \"offset\" and \"limit\", and filtering via \"nodeTypes\". Other actions ignore these parameters. This tool never modifies the document. Do NOT call superdoc_edit or superdoc_format without first reading blocks to get valid refs and formatting reference values.",
7
7
  "parameters": {
8
8
  "type": "object",
9
9
  "properties": {
@@ -63,11 +63,20 @@
63
63
  "doc.info",
64
64
  "doc.blocks.list"
65
65
  ]
66
+ },
67
+ "annotations": {
68
+ "readOnlyHint": true,
69
+ "destructiveHint": false,
70
+ "idempotentHint": true,
71
+ "openWorldHint": false,
72
+ "reversible": false,
73
+ "supportsDryRun": false,
74
+ "supportsTrackedChanges": false
66
75
  }
67
76
  },
68
77
  {
69
78
  "name": "superdoc_edit",
70
- "description": "Insert, replace, delete text, or undo/redo",
79
+ "description": "Refs expire after any mutation; always re-search before the next edit. Modify document text: insert new content, replace existing text, delete a range, or undo/redo. Use this for single text modifications. For 2+ edits that must succeed or fail atomically, use superdoc_mutations instead. For replace and delete, pass a \"ref\" from superdoc_search or superdoc_get_content blocks. A search ref covers only the matched substring; a block ref covers the entire block text, so use block refs when rewriting or shortening whole paragraphs. Insert supports plain text (default), markdown, or html via the \"type\" parameter. Use \"placement\" (before, after, insideStart, insideEnd) to control position relative to the target. Supports \"dryRun\" to preview changes and \"changeMode: tracked\" to record edits as tracked changes. Do NOT build \"target\" objects manually when a ref is available; prefer \"ref\" for simpler, more reliable targeting.",
71
80
  "parameters": {
72
81
  "type": "object",
73
82
  "properties": {
@@ -289,7 +298,7 @@
289
298
  ]
290
299
  }
291
300
  ],
292
- "description": "Target address object. Use 'ref' instead if you have a search handle. Format: {kind:'text', blockId, range:{start,end}} or {kind:'block', nodeType, nodeId}."
301
+ "description": "Target address. For inline/set_style: prefer 'ref' from superdoc_search, or use {kind:'selection', start:{kind:'text', blockId, offset}, end:{kind:'text', blockId, offset}}. For paragraph actions (set_alignment, set_indentation, set_spacing, set_direction, set_flow_options): use {kind:'block', nodeType:'paragraph'|'heading'|'listItem', nodeId:'<nodeId from blocks list>'}."
293
302
  },
294
303
  "value": {
295
304
  "type": "string",
@@ -306,7 +315,7 @@
306
315
  },
307
316
  "ref": {
308
317
  "type": "string",
309
- "description": "Handle ref string returned by a prior search/query result."
318
+ "description": "Handle ref from superdoc_search result (pass handle.ref value directly). Preferred over building a target object."
310
319
  },
311
320
  "content": {
312
321
  "oneOf": [
@@ -346,22 +355,6 @@
346
355
  },
347
356
  "description": "Controls nesting behavior. tables: 'allow' permits inserting tables inside other tables. Only for actions 'insert', 'replace'. Omit for other actions."
348
357
  },
349
- "blockId": {
350
- "type": "string",
351
- "description": "Block ID of the target paragraph."
352
- },
353
- "start": {
354
- "type": "number",
355
- "description": "Start offset within the block (character index)."
356
- },
357
- "end": {
358
- "type": "number",
359
- "description": "End offset within the block (character index)."
360
- },
361
- "offset": {
362
- "type": "number",
363
- "description": "Character offset for insertion (alias for --start/--end with same value). Only for action 'insert'. Omit for other actions."
364
- },
365
358
  "text": {
366
359
  "type": "string",
367
360
  "description": "Replacement text content. Only for action 'replace'. Omit for other actions."
@@ -390,11 +383,20 @@
390
383
  "doc.history.undo",
391
384
  "doc.history.redo"
392
385
  ]
386
+ },
387
+ "annotations": {
388
+ "readOnlyHint": false,
389
+ "destructiveHint": false,
390
+ "idempotentHint": false,
391
+ "openWorldHint": false,
392
+ "reversible": true,
393
+ "supportsDryRun": true,
394
+ "supportsTrackedChanges": true
393
395
  }
394
396
  },
395
397
  {
396
398
  "name": "superdoc_format",
397
- "description": "Change text and paragraph formatting. Use action \"inline\" with a search ref for bold/italic/etc. Use action \"set_style\" with a styleId from superdoc_get_content info to apply a named paragraph style.",
399
+ "description": "Change text and paragraph formatting. Use this after superdoc_create to style new content, or with a search ref to restyle existing text. Action \"inline\" applies character formatting (bold, italic, underline, color, fontSize, fontFamily, highlight, strike, vertAlign) to a text range via \"ref\". Action \"set_style\" applies a named paragraph style by styleId (get available styles from superdoc_get_content info). Actions \"set_alignment\", \"set_indentation\", \"set_spacing\", \"set_direction\", and \"set_flow_options\" change paragraph-level properties and require a block target: {kind:\"block\", nodeType:\"paragraph\", nodeId:\"<nodeId>\"}, NOT a ref. Use \"set_flow_options\" with pageBreakBefore:true to start a paragraph on a new page. Supports \"dryRun\" and \"changeMode: tracked\" for inline formatting. Paragraph-level actions do NOT support tracked changes. Do NOT use a search ref for paragraph-level actions; they require a block target with nodeId. Do NOT use {kind:\"block\", start:{kind:\"nodeEdge\",...}} or selection-like structures for paragraph actions. ONLY {kind:\"block\", nodeType, nodeId} is accepted. Do NOT issue multiple superdoc_format calls in parallel; each call invalidates refs for subsequent calls. Format one block at a time. Do NOT hardcode formatting values; always read them from superdoc_get_content blocks and replicate.",
398
400
  "parameters": {
399
401
  "type": "object",
400
402
  "properties": {
@@ -404,11 +406,12 @@
404
406
  "inline",
405
407
  "set_alignment",
406
408
  "set_direction",
409
+ "set_flow_options",
407
410
  "set_indentation",
408
411
  "set_spacing",
409
412
  "set_style"
410
413
  ],
411
- "description": "The action to perform. One of: inline, set_alignment, set_direction, set_indentation, set_spacing, set_style."
414
+ "description": "The action to perform. One of: inline, set_alignment, set_direction, set_flow_options, set_indentation, set_spacing, set_style."
412
415
  },
413
416
  "force": {
414
417
  "type": "boolean",
@@ -583,7 +586,7 @@
583
586
  "start",
584
587
  "end"
585
588
  ],
586
- "description": "Selection target: {kind:'selection', start:{kind:'text', blockId, offset}, end:{kind:'text', blockId, offset}}. Use 'ref' instead when you have a search result handle. Required for actions 'set_style', 'set_alignment', 'set_indentation', 'set_spacing', 'set_direction'."
589
+ "description": "Selection target: {kind:'selection', start:{kind:'text', blockId, offset}, end:{kind:'text', blockId, offset}}. Use 'ref' instead when you have a search result handle. Required for actions 'set_style', 'set_alignment', 'set_indentation', 'set_spacing', 'set_flow_options', 'set_direction'."
587
590
  },
588
591
  "inline": {
589
592
  "type": "object",
@@ -901,6 +904,18 @@
901
904
  "atLeast"
902
905
  ]
903
906
  },
907
+ "contextualSpacing": {
908
+ "type": "boolean",
909
+ "description": "Only for action 'set_flow_options'. Omit for other actions."
910
+ },
911
+ "pageBreakBefore": {
912
+ "type": "boolean",
913
+ "description": "Only for action 'set_flow_options'. Omit for other actions."
914
+ },
915
+ "suppressAutoHyphens": {
916
+ "type": "boolean",
917
+ "description": "Only for action 'set_flow_options'. Omit for other actions."
918
+ },
904
919
  "direction": {
905
920
  "type": "string",
906
921
  "enum": [
@@ -925,20 +940,30 @@
925
940
  },
926
941
  "metadata": {
927
942
  "mutates": true,
928
- "operationCount": 6,
943
+ "operationCount": 7,
929
944
  "operations": [
930
945
  "doc.format.apply",
931
946
  "doc.styles.paragraph.setStyle",
932
947
  "doc.format.paragraph.setAlignment",
933
948
  "doc.format.paragraph.setIndentation",
934
949
  "doc.format.paragraph.setSpacing",
950
+ "doc.format.paragraph.setFlowOptions",
935
951
  "doc.format.paragraph.setDirection"
936
952
  ]
953
+ },
954
+ "annotations": {
955
+ "readOnlyHint": false,
956
+ "destructiveHint": false,
957
+ "idempotentHint": false,
958
+ "openWorldHint": false,
959
+ "reversible": true,
960
+ "supportsDryRun": true,
961
+ "supportsTrackedChanges": true
937
962
  }
938
963
  },
939
964
  {
940
965
  "name": "superdoc_create",
941
- "description": "Create one paragraph or heading per call. After creating, search for it and apply formatting (fontFamily, fontSize) from neighboring blocks. For multiple paragraphs, use superdoc_mutations with text.insert steps instead of calling create repeatedly.",
966
+ "description": "You MUST call superdoc_format after this tool to match document styling. Create a single paragraph, heading, or table in the document. Returns a nodeId for chaining subsequent creates and for use as a block target in superdoc_format. When the user asks for a \"heading\", use action \"heading\" with a level (default 1). Use action \"paragraph\" only when the user asks for regular body text. Before creating, call superdoc_get_content blocks to read formatting from regular body text paragraphs (non-empty, non-title blocks with alignment \"justify\" or \"left\"). After creating, re-fetch blocks with superdoc_get_content to get a fresh ref for the new block, then apply TWO format calls: (1) superdoc_format action \"inline\" for character styling, AND (2) superdoc_format action \"set_alignment\" with the block target for paragraph alignment. Both calls are REQUIRED. For body paragraphs: inline {bold:false, underline:false, fontFamily, fontSize, color from body blocks}, alignment \"justify\". Ignore underline:true from blocks data for body text; it is a style artifact. For headings: inline {bold:true, underline:true, fontSize scaled up, fontFamily, color}, alignment \"center\". Position with \"at\": {kind:\"documentEnd\"} (default), {kind:\"documentStart\"}, or {kind:\"after\"/\"before\", target:{kind:\"block\", nodeType, nodeId}} for relative placement. When creating multiple items in sequence, use the previous response nodeId as the next \"at\" target to maintain correct ordering. Do NOT use newlines in \"text\" to create multiple paragraphs; call this tool separately for each one.",
942
967
  "parameters": {
943
968
  "type": "object",
944
969
  "properties": {
@@ -946,9 +971,10 @@
946
971
  "type": "string",
947
972
  "enum": [
948
973
  "heading",
949
- "paragraph"
974
+ "paragraph",
975
+ "table"
950
976
  ],
951
- "description": "The action to perform. One of: heading, paragraph."
977
+ "description": "The action to perform. One of: heading, paragraph, table."
952
978
  },
953
979
  "force": {
954
980
  "type": "boolean",
@@ -1092,6 +1118,14 @@
1092
1118
  "level": {
1093
1119
  "type": "number",
1094
1120
  "description": "Heading level (1-6). Required for action 'heading'."
1121
+ },
1122
+ "rows": {
1123
+ "type": "number",
1124
+ "description": "Required for action 'table'."
1125
+ },
1126
+ "columns": {
1127
+ "type": "number",
1128
+ "description": "Required for action 'table'."
1095
1129
  }
1096
1130
  },
1097
1131
  "required": [
@@ -1101,16 +1135,26 @@
1101
1135
  },
1102
1136
  "metadata": {
1103
1137
  "mutates": true,
1104
- "operationCount": 2,
1138
+ "operationCount": 3,
1105
1139
  "operations": [
1106
1140
  "doc.create.paragraph",
1107
- "doc.create.heading"
1141
+ "doc.create.heading",
1142
+ "doc.create.table"
1108
1143
  ]
1144
+ },
1145
+ "annotations": {
1146
+ "readOnlyHint": false,
1147
+ "destructiveHint": false,
1148
+ "idempotentHint": false,
1149
+ "openWorldHint": false,
1150
+ "reversible": true,
1151
+ "supportsDryRun": true,
1152
+ "supportsTrackedChanges": true
1109
1153
  }
1110
1154
  },
1111
1155
  {
1112
1156
  "name": "superdoc_list",
1113
- "description": "Create and manipulate lists",
1157
+ "description": "Create and manipulate bullet and numbered lists. To create a list: first create all paragraphs at the SAME location using superdoc_create (chain each using the previous nodeId as the \"at\" target). Then call action \"create\" with mode:\"fromParagraphs\", a preset (\"disc\" for bullet, \"decimal\" for numbered), and a range target: {from:{kind:\"block\", nodeType:\"paragraph\", nodeId:\"<first>\"}, to:{kind:\"block\", nodeType:\"paragraph\", nodeId:\"<last>\"}}. The range converts ALL paragraphs between from and to into list items. Make sure no other content exists between them. Action \"set_type\" converts between bullet and ordered (target any item in the list, kind:\"ordered\" or \"bullet\"). Action \"insert\" adds a new item before/after a target list item. Actions \"indent\" and \"outdent\" change nesting level; \"set_level\" jumps to a specific level (0-8). Action \"detach\" converts a list item back to a plain paragraph. Do NOT target paragraphs with indent/outdent/set_type; these actions require a listItem target.",
1114
1158
  "parameters": {
1115
1159
  "type": "object",
1116
1160
  "properties": {
@@ -1373,11 +1417,20 @@
1373
1417
  "doc.lists.setLevel",
1374
1418
  "doc.lists.setType"
1375
1419
  ]
1420
+ },
1421
+ "annotations": {
1422
+ "readOnlyHint": false,
1423
+ "destructiveHint": false,
1424
+ "idempotentHint": false,
1425
+ "openWorldHint": false,
1426
+ "reversible": true,
1427
+ "supportsDryRun": true,
1428
+ "supportsTrackedChanges": true
1376
1429
  }
1377
1430
  },
1378
1431
  {
1379
1432
  "name": "superdoc_comment",
1380
- "description": "Comment threads — create, edit, delete",
1433
+ "description": "Manage document comment threads: create, read, update, and delete. To create a comment, first use superdoc_search to find the target text, then pass action \"create\" with the comment text and a target: {kind:\"text\", blockId:\"<blockId>\", range:{start:<N>, end:<N>}} using the blockId and highlightRange from the search result. For threaded replies, pass \"parentId\" with the parent comment ID. Action \"list\" returns all comments with optional pagination (limit, offset) and filtering (includeResolved:true to include resolved). Action \"get\" retrieves a single comment by ID. Action \"update\" changes status to \"resolved\" or marks as internal. Action \"delete\" removes a comment or reply by ID. Do NOT pass \"ref\", \"id\", or \"parentId\" when creating a new top-level comment; only \"action\", \"text\", and \"target\" are needed.",
1381
1434
  "parameters": {
1382
1435
  "type": "object",
1383
1436
  "properties": {
@@ -1488,11 +1541,20 @@
1488
1541
  "doc.comments.get",
1489
1542
  "doc.comments.list"
1490
1543
  ]
1544
+ },
1545
+ "annotations": {
1546
+ "readOnlyHint": false,
1547
+ "destructiveHint": true,
1548
+ "idempotentHint": false,
1549
+ "openWorldHint": false,
1550
+ "reversible": false,
1551
+ "supportsDryRun": false,
1552
+ "supportsTrackedChanges": false
1491
1553
  }
1492
1554
  },
1493
1555
  {
1494
1556
  "name": "superdoc_track_changes",
1495
- "description": "Review and resolve tracked changes",
1557
+ "description": "Review and resolve tracked changes (insertions, deletions, format changes) in the document. Action \"list\" returns all tracked changes with optional filtering by type (insert, delete, format) and pagination (limit, offset). Each change includes an ID, type, author, timestamp, and content preview. Action \"decide\" accepts or rejects changes. Pass decision:\"accept\" to apply the change permanently, or decision:\"reject\" to discard it. Target a single change with {id:\"<changeId>\"} or all changes at once with {scope:\"all\"}. Do NOT use this tool unless the document has tracked changes. Use superdoc_get_content info to check the tracked change count first.",
1496
1558
  "parameters": {
1497
1559
  "type": "object",
1498
1560
  "properties": {
@@ -1583,11 +1645,20 @@
1583
1645
  "doc.trackChanges.list",
1584
1646
  "doc.trackChanges.decide"
1585
1647
  ]
1648
+ },
1649
+ "annotations": {
1650
+ "readOnlyHint": false,
1651
+ "destructiveHint": true,
1652
+ "idempotentHint": false,
1653
+ "openWorldHint": false,
1654
+ "reversible": false,
1655
+ "supportsDryRun": false,
1656
+ "supportsTrackedChanges": false
1586
1657
  }
1587
1658
  },
1588
1659
  {
1589
1660
  "name": "superdoc_search",
1590
- "description": "Find text or nodes in the document",
1661
+ "description": "Refs expire after any mutation; always re-search before the next edit. Find text patterns or nodes in the document and get ref handles for targeting edits and formatting. Use this to locate content before calling superdoc_edit or superdoc_format. Text search returns handle.ref covering only the matched substring. Node search finds blocks by type (paragraph, heading, table, listItem, etc.). The \"require\" parameter controls match cardinality: \"first\" returns one match, \"all\" returns every match, \"exactlyOne\" fails if not exactly one match. Supports scoping via \"within\" to search inside a single block. Do NOT use regex or markdown formatting markers (#, **, etc.) in search patterns; patterns are plain text only. Do NOT use this tool when you already have a ref from superdoc_get_content blocks or superdoc_create; use that ref directly.",
1591
1662
  "parameters": {
1592
1663
  "type": "object",
1593
1664
  "properties": {
@@ -1745,11 +1816,20 @@
1745
1816
  "operations": [
1746
1817
  "doc.query.match"
1747
1818
  ]
1819
+ },
1820
+ "annotations": {
1821
+ "readOnlyHint": true,
1822
+ "destructiveHint": false,
1823
+ "idempotentHint": true,
1824
+ "openWorldHint": false,
1825
+ "reversible": false,
1826
+ "supportsDryRun": false,
1827
+ "supportsTrackedChanges": false
1748
1828
  }
1749
1829
  },
1750
1830
  {
1751
1831
  "name": "superdoc_mutations",
1752
- "description": "Atomic multi-step batch edits (escape hatch)",
1832
+ "description": "All steps succeed or all fail; no partial application. Execute multiple text edits atomically in a single batch. Use this INSTEAD OF multiple sequential superdoc_edit calls when you need 2+ text changes that should succeed or fail together. Each step has an id (e.g. \"s1\"), an op (text.rewrite, text.insert, text.delete, format.apply, assert), a \"where\" clause for targeting ({by:\"select\", select:{...}, require:\"first\"|\"exactlyOne\"|\"all\"} or {by:\"ref\", ref:\"...\"}), and \"args\" with operation-specific parameters. Action \"preview\" dry-runs the plan without modifying the document. Action \"apply\" executes it. CRITICAL: split mutations by phase. Text mutations (text.rewrite, text.insert, text.delete) go in one call. Formatting (format.apply) goes in a separate call with fresh refs from a new superdoc_search. Do NOT create two steps that target overlapping text in the same block; combine them into a single text.rewrite step. Overlapping steps fail with PLAN_CONFLICT_OVERLAP. Do NOT use this for single edits; use superdoc_edit instead. Do NOT mix text mutations and formatting in the same call.",
1753
1833
  "parameters": {
1754
1834
  "type": "object",
1755
1835
  "properties": {
@@ -3704,6 +3784,15 @@
3704
3784
  "doc.mutations.preview",
3705
3785
  "doc.mutations.apply"
3706
3786
  ]
3787
+ },
3788
+ "annotations": {
3789
+ "readOnlyHint": false,
3790
+ "destructiveHint": false,
3791
+ "idempotentHint": false,
3792
+ "openWorldHint": false,
3793
+ "reversible": false,
3794
+ "supportsDryRun": false,
3795
+ "supportsTrackedChanges": true
3707
3796
  }
3708
3797
  }
3709
3798
  ]
@@ -5,7 +5,7 @@
5
5
  "type": "function",
6
6
  "function": {
7
7
  "name": "superdoc_get_content",
8
- "description": "Read document content. Use action \"info\" for structure and styles, \"blocks\" for all block IDs and types, \"text\" or \"markdown\" for content. Call info or blocks before editing.",
8
+ "description": "Read document content in various formats. Call this first in any workflow to understand document structure before making edits. Action \"blocks\" returns structured block data with nodeId, nodeType, textPreview, formatting properties (fontFamily, fontSize, color, bold, underline, alignment), and ref handles for immediate use with superdoc_edit or superdoc_format. Action \"text\" and \"markdown\" return the full document as plain text or Markdown. Action \"html\" returns HTML. Action \"info\" returns document metadata: word count, paragraph count, page count, outline, available styles, and capability flags. The \"blocks\" action supports pagination via \"offset\" and \"limit\", and filtering via \"nodeTypes\". Other actions ignore these parameters. This tool never modifies the document. Do NOT call superdoc_edit or superdoc_format without first reading blocks to get valid refs and formatting reference values.",
9
9
  "parameters": {
10
10
  "type": "object",
11
11
  "properties": {
@@ -61,7 +61,7 @@
61
61
  "type": "function",
62
62
  "function": {
63
63
  "name": "superdoc_edit",
64
- "description": "Insert, replace, delete text, or undo/redo",
64
+ "description": "Refs expire after any mutation; always re-search before the next edit. Modify document text: insert new content, replace existing text, delete a range, or undo/redo. Use this for single text modifications. For 2+ edits that must succeed or fail atomically, use superdoc_mutations instead. For replace and delete, pass a \"ref\" from superdoc_search or superdoc_get_content blocks. A search ref covers only the matched substring; a block ref covers the entire block text, so use block refs when rewriting or shortening whole paragraphs. Insert supports plain text (default), markdown, or html via the \"type\" parameter. Use \"placement\" (before, after, insideStart, insideEnd) to control position relative to the target. Supports \"dryRun\" to preview changes and \"changeMode: tracked\" to record edits as tracked changes. Do NOT build \"target\" objects manually when a ref is available; prefer \"ref\" for simpler, more reliable targeting.",
65
65
  "parameters": {
66
66
  "type": "object",
67
67
  "properties": {
@@ -283,7 +283,7 @@
283
283
  ]
284
284
  }
285
285
  ],
286
- "description": "Target address object. Use 'ref' instead if you have a search handle. Format: {kind:'text', blockId, range:{start,end}} or {kind:'block', nodeType, nodeId}."
286
+ "description": "Target address. For inline/set_style: prefer 'ref' from superdoc_search, or use {kind:'selection', start:{kind:'text', blockId, offset}, end:{kind:'text', blockId, offset}}. For paragraph actions (set_alignment, set_indentation, set_spacing, set_direction, set_flow_options): use {kind:'block', nodeType:'paragraph'|'heading'|'listItem', nodeId:'<nodeId from blocks list>'}."
287
287
  },
288
288
  "value": {
289
289
  "type": "string",
@@ -300,7 +300,7 @@
300
300
  },
301
301
  "ref": {
302
302
  "type": "string",
303
- "description": "Handle ref string returned by a prior search/query result."
303
+ "description": "Handle ref from superdoc_search result (pass handle.ref value directly). Preferred over building a target object."
304
304
  },
305
305
  "content": {
306
306
  "oneOf": [
@@ -340,22 +340,6 @@
340
340
  },
341
341
  "description": "Controls nesting behavior. tables: 'allow' permits inserting tables inside other tables. Only for actions 'insert', 'replace'. Omit for other actions."
342
342
  },
343
- "blockId": {
344
- "type": "string",
345
- "description": "Block ID of the target paragraph."
346
- },
347
- "start": {
348
- "type": "number",
349
- "description": "Start offset within the block (character index)."
350
- },
351
- "end": {
352
- "type": "number",
353
- "description": "End offset within the block (character index)."
354
- },
355
- "offset": {
356
- "type": "number",
357
- "description": "Character offset for insertion (alias for --start/--end with same value). Only for action 'insert'. Omit for other actions."
358
- },
359
343
  "text": {
360
344
  "type": "string",
361
345
  "description": "Replacement text content. Only for action 'replace'. Omit for other actions."
@@ -380,7 +364,7 @@
380
364
  "type": "function",
381
365
  "function": {
382
366
  "name": "superdoc_format",
383
- "description": "Change text and paragraph formatting. Use action \"inline\" with a search ref for bold/italic/etc. Use action \"set_style\" with a styleId from superdoc_get_content info to apply a named paragraph style.",
367
+ "description": "Change text and paragraph formatting. Use this after superdoc_create to style new content, or with a search ref to restyle existing text. Action \"inline\" applies character formatting (bold, italic, underline, color, fontSize, fontFamily, highlight, strike, vertAlign) to a text range via \"ref\". Action \"set_style\" applies a named paragraph style by styleId (get available styles from superdoc_get_content info). Actions \"set_alignment\", \"set_indentation\", \"set_spacing\", \"set_direction\", and \"set_flow_options\" change paragraph-level properties and require a block target: {kind:\"block\", nodeType:\"paragraph\", nodeId:\"<nodeId>\"}, NOT a ref. Use \"set_flow_options\" with pageBreakBefore:true to start a paragraph on a new page. Supports \"dryRun\" and \"changeMode: tracked\" for inline formatting. Paragraph-level actions do NOT support tracked changes. Do NOT use a search ref for paragraph-level actions; they require a block target with nodeId. Do NOT use {kind:\"block\", start:{kind:\"nodeEdge\",...}} or selection-like structures for paragraph actions. ONLY {kind:\"block\", nodeType, nodeId} is accepted. Do NOT issue multiple superdoc_format calls in parallel; each call invalidates refs for subsequent calls. Format one block at a time. Do NOT hardcode formatting values; always read them from superdoc_get_content blocks and replicate.",
384
368
  "parameters": {
385
369
  "type": "object",
386
370
  "properties": {
@@ -390,11 +374,12 @@
390
374
  "inline",
391
375
  "set_alignment",
392
376
  "set_direction",
377
+ "set_flow_options",
393
378
  "set_indentation",
394
379
  "set_spacing",
395
380
  "set_style"
396
381
  ],
397
- "description": "The action to perform. One of: inline, set_alignment, set_direction, set_indentation, set_spacing, set_style."
382
+ "description": "The action to perform. One of: inline, set_alignment, set_direction, set_flow_options, set_indentation, set_spacing, set_style."
398
383
  },
399
384
  "force": {
400
385
  "type": "boolean",
@@ -569,7 +554,7 @@
569
554
  "start",
570
555
  "end"
571
556
  ],
572
- "description": "Selection target: {kind:'selection', start:{kind:'text', blockId, offset}, end:{kind:'text', blockId, offset}}. Use 'ref' instead when you have a search result handle. Required for actions 'set_style', 'set_alignment', 'set_indentation', 'set_spacing', 'set_direction'."
557
+ "description": "Selection target: {kind:'selection', start:{kind:'text', blockId, offset}, end:{kind:'text', blockId, offset}}. Use 'ref' instead when you have a search result handle. Required for actions 'set_style', 'set_alignment', 'set_indentation', 'set_spacing', 'set_flow_options', 'set_direction'."
573
558
  },
574
559
  "inline": {
575
560
  "type": "object",
@@ -887,6 +872,18 @@
887
872
  "atLeast"
888
873
  ]
889
874
  },
875
+ "contextualSpacing": {
876
+ "type": "boolean",
877
+ "description": "Only for action 'set_flow_options'. Omit for other actions."
878
+ },
879
+ "pageBreakBefore": {
880
+ "type": "boolean",
881
+ "description": "Only for action 'set_flow_options'. Omit for other actions."
882
+ },
883
+ "suppressAutoHyphens": {
884
+ "type": "boolean",
885
+ "description": "Only for action 'set_flow_options'. Omit for other actions."
886
+ },
890
887
  "direction": {
891
888
  "type": "string",
892
889
  "enum": [
@@ -915,7 +912,7 @@
915
912
  "type": "function",
916
913
  "function": {
917
914
  "name": "superdoc_create",
918
- "description": "Create one paragraph or heading per call. After creating, search for it and apply formatting (fontFamily, fontSize) from neighboring blocks. For multiple paragraphs, use superdoc_mutations with text.insert steps instead of calling create repeatedly.",
915
+ "description": "You MUST call superdoc_format after this tool to match document styling. Create a single paragraph, heading, or table in the document. Returns a nodeId for chaining subsequent creates and for use as a block target in superdoc_format. When the user asks for a \"heading\", use action \"heading\" with a level (default 1). Use action \"paragraph\" only when the user asks for regular body text. Before creating, call superdoc_get_content blocks to read formatting from regular body text paragraphs (non-empty, non-title blocks with alignment \"justify\" or \"left\"). After creating, re-fetch blocks with superdoc_get_content to get a fresh ref for the new block, then apply TWO format calls: (1) superdoc_format action \"inline\" for character styling, AND (2) superdoc_format action \"set_alignment\" with the block target for paragraph alignment. Both calls are REQUIRED. For body paragraphs: inline {bold:false, underline:false, fontFamily, fontSize, color from body blocks}, alignment \"justify\". Ignore underline:true from blocks data for body text; it is a style artifact. For headings: inline {bold:true, underline:true, fontSize scaled up, fontFamily, color}, alignment \"center\". Position with \"at\": {kind:\"documentEnd\"} (default), {kind:\"documentStart\"}, or {kind:\"after\"/\"before\", target:{kind:\"block\", nodeType, nodeId}} for relative placement. When creating multiple items in sequence, use the previous response nodeId as the next \"at\" target to maintain correct ordering. Do NOT use newlines in \"text\" to create multiple paragraphs; call this tool separately for each one.",
919
916
  "parameters": {
920
917
  "type": "object",
921
918
  "properties": {
@@ -923,9 +920,10 @@
923
920
  "type": "string",
924
921
  "enum": [
925
922
  "heading",
926
- "paragraph"
923
+ "paragraph",
924
+ "table"
927
925
  ],
928
- "description": "The action to perform. One of: heading, paragraph."
926
+ "description": "The action to perform. One of: heading, paragraph, table."
929
927
  },
930
928
  "force": {
931
929
  "type": "boolean",
@@ -1069,6 +1067,14 @@
1069
1067
  "level": {
1070
1068
  "type": "number",
1071
1069
  "description": "Heading level (1-6). Required for action 'heading'."
1070
+ },
1071
+ "rows": {
1072
+ "type": "number",
1073
+ "description": "Required for action 'table'."
1074
+ },
1075
+ "columns": {
1076
+ "type": "number",
1077
+ "description": "Required for action 'table'."
1072
1078
  }
1073
1079
  },
1074
1080
  "required": [
@@ -1082,7 +1088,7 @@
1082
1088
  "type": "function",
1083
1089
  "function": {
1084
1090
  "name": "superdoc_list",
1085
- "description": "Create and manipulate lists",
1091
+ "description": "Create and manipulate bullet and numbered lists. To create a list: first create all paragraphs at the SAME location using superdoc_create (chain each using the previous nodeId as the \"at\" target). Then call action \"create\" with mode:\"fromParagraphs\", a preset (\"disc\" for bullet, \"decimal\" for numbered), and a range target: {from:{kind:\"block\", nodeType:\"paragraph\", nodeId:\"<first>\"}, to:{kind:\"block\", nodeType:\"paragraph\", nodeId:\"<last>\"}}. The range converts ALL paragraphs between from and to into list items. Make sure no other content exists between them. Action \"set_type\" converts between bullet and ordered (target any item in the list, kind:\"ordered\" or \"bullet\"). Action \"insert\" adds a new item before/after a target list item. Actions \"indent\" and \"outdent\" change nesting level; \"set_level\" jumps to a specific level (0-8). Action \"detach\" converts a list item back to a plain paragraph. Do NOT target paragraphs with indent/outdent/set_type; these actions require a listItem target.",
1086
1092
  "parameters": {
1087
1093
  "type": "object",
1088
1094
  "properties": {
@@ -1339,7 +1345,7 @@
1339
1345
  "type": "function",
1340
1346
  "function": {
1341
1347
  "name": "superdoc_comment",
1342
- "description": "Comment threads — create, edit, delete",
1348
+ "description": "Manage document comment threads: create, read, update, and delete. To create a comment, first use superdoc_search to find the target text, then pass action \"create\" with the comment text and a target: {kind:\"text\", blockId:\"<blockId>\", range:{start:<N>, end:<N>}} using the blockId and highlightRange from the search result. For threaded replies, pass \"parentId\" with the parent comment ID. Action \"list\" returns all comments with optional pagination (limit, offset) and filtering (includeResolved:true to include resolved). Action \"get\" retrieves a single comment by ID. Action \"update\" changes status to \"resolved\" or marks as internal. Action \"delete\" removes a comment or reply by ID. Do NOT pass \"ref\", \"id\", or \"parentId\" when creating a new top-level comment; only \"action\", \"text\", and \"target\" are needed.",
1343
1349
  "parameters": {
1344
1350
  "type": "object",
1345
1351
  "properties": {
@@ -1446,7 +1452,7 @@
1446
1452
  "type": "function",
1447
1453
  "function": {
1448
1454
  "name": "superdoc_track_changes",
1449
- "description": "Review and resolve tracked changes",
1455
+ "description": "Review and resolve tracked changes (insertions, deletions, format changes) in the document. Action \"list\" returns all tracked changes with optional filtering by type (insert, delete, format) and pagination (limit, offset). Each change includes an ID, type, author, timestamp, and content preview. Action \"decide\" accepts or rejects changes. Pass decision:\"accept\" to apply the change permanently, or decision:\"reject\" to discard it. Target a single change with {id:\"<changeId>\"} or all changes at once with {scope:\"all\"}. Do NOT use this tool unless the document has tracked changes. Use superdoc_get_content info to check the tracked change count first.",
1450
1456
  "parameters": {
1451
1457
  "type": "object",
1452
1458
  "properties": {
@@ -1536,7 +1542,7 @@
1536
1542
  "type": "function",
1537
1543
  "function": {
1538
1544
  "name": "superdoc_search",
1539
- "description": "Find text or nodes in the document",
1545
+ "description": "Refs expire after any mutation; always re-search before the next edit. Find text patterns or nodes in the document and get ref handles for targeting edits and formatting. Use this to locate content before calling superdoc_edit or superdoc_format. Text search returns handle.ref covering only the matched substring. Node search finds blocks by type (paragraph, heading, table, listItem, etc.). The \"require\" parameter controls match cardinality: \"first\" returns one match, \"all\" returns every match, \"exactlyOne\" fails if not exactly one match. Supports scoping via \"within\" to search inside a single block. Do NOT use regex or markdown formatting markers (#, **, etc.) in search patterns; patterns are plain text only. Do NOT use this tool when you already have a ref from superdoc_get_content blocks or superdoc_create; use that ref directly.",
1540
1546
  "parameters": {
1541
1547
  "type": "object",
1542
1548
  "properties": {
@@ -1694,7 +1700,7 @@
1694
1700
  "type": "function",
1695
1701
  "function": {
1696
1702
  "name": "superdoc_mutations",
1697
- "description": "Atomic multi-step batch edits (escape hatch)",
1703
+ "description": "All steps succeed or all fail; no partial application. Execute multiple text edits atomically in a single batch. Use this INSTEAD OF multiple sequential superdoc_edit calls when you need 2+ text changes that should succeed or fail together. Each step has an id (e.g. \"s1\"), an op (text.rewrite, text.insert, text.delete, format.apply, assert), a \"where\" clause for targeting ({by:\"select\", select:{...}, require:\"first\"|\"exactlyOne\"|\"all\"} or {by:\"ref\", ref:\"...\"}), and \"args\" with operation-specific parameters. Action \"preview\" dry-runs the plan without modifying the document. Action \"apply\" executes it. CRITICAL: split mutations by phase. Text mutations (text.rewrite, text.insert, text.delete) go in one call. Formatting (format.apply) goes in a separate call with fresh refs from a new superdoc_search. Do NOT create two steps that target overlapping text in the same block; combine them into a single text.rewrite step. Overlapping steps fail with PLAN_CONFLICT_OVERLAP. Do NOT use this for single edits; use superdoc_edit instead. Do NOT mix text mutations and formatting in the same call.",
1698
1704
  "parameters": {
1699
1705
  "type": "object",
1700
1706
  "properties": {