@superdoc-dev/sdk 1.3.0-next.7 → 1.3.0-next.70

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.
@@ -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": {