@superdoc-dev/sdk 1.3.0-next.7 → 1.3.0-next.71
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.
- package/dist/generated/client.cjs +28 -0
- package/dist/generated/client.d.ts +7920 -1929
- package/dist/generated/client.d.ts.map +1 -1
- package/dist/generated/client.js +28 -0
- package/dist/generated/contract.cjs +29400 -27262
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/contract.js +30498 -27262
- package/dist/generated/intent-dispatch.generated.cjs +2 -0
- package/dist/generated/intent-dispatch.generated.d.ts.map +1 -1
- package/dist/generated/intent-dispatch.generated.js +2 -0
- package/package.json +6 -6
- package/tools/__pycache__/__init__.cpython-312.pyc +0 -0
- package/tools/__pycache__/intent_dispatch_generated.cpython-312.pyc +0 -0
- package/tools/catalog.json +63 -31
- package/tools/intent_dispatch_generated.py +4 -0
- package/tools/system-prompt.md +143 -102
- package/tools/tools-policy.json +1 -1
- package/tools/tools.anthropic.json +37 -31
- package/tools/tools.generic.json +123 -34
- package/tools/tools.openai.json +37 -31
- package/tools/tools.vercel.json +37 -31
package/tools/system-prompt.md
CHANGED
|
@@ -4,146 +4,187 @@ You are a document editing assistant. You have a DOCX document open and a set of
|
|
|
4
4
|
|
|
5
5
|
## Tools overview
|
|
6
6
|
|
|
7
|
-
| Tool | Purpose |
|
|
8
|
-
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
| superdoc_edit | Insert, replace, delete text, undo/redo |
|
|
12
|
-
| superdoc_create | Create paragraphs or
|
|
13
|
-
| superdoc_format | Apply inline and paragraph formatting, set named styles |
|
|
14
|
-
| superdoc_list | Create and manipulate bullet/numbered lists |
|
|
15
|
-
| superdoc_comment | Create, update, delete, and list
|
|
16
|
-
| superdoc_track_changes |
|
|
17
|
-
| superdoc_mutations | Execute multi-step atomic edits in a single batch |
|
|
7
|
+
| Tool | Purpose | Mutates |
|
|
8
|
+
|------|---------|---------|
|
|
9
|
+
| superdoc_get_content | Read document content (blocks, text, markdown, html, info) | No |
|
|
10
|
+
| superdoc_search | Find text or nodes, get ref handles for targeting | No |
|
|
11
|
+
| superdoc_edit | Insert, replace, delete text, undo/redo | Yes |
|
|
12
|
+
| superdoc_create | Create paragraphs, headings, or tables | Yes |
|
|
13
|
+
| superdoc_format | Apply inline and paragraph formatting, set named styles | Yes |
|
|
14
|
+
| superdoc_list | Create and manipulate bullet/numbered lists | Yes |
|
|
15
|
+
| superdoc_comment | Create, update, delete, and list comment threads | Yes |
|
|
16
|
+
| superdoc_track_changes | List, accept, or reject tracked changes | Yes |
|
|
17
|
+
| superdoc_mutations | Execute multi-step atomic edits in a single batch | Yes |
|
|
18
18
|
|
|
19
19
|
## How targeting works
|
|
20
20
|
|
|
21
|
-
Every editing tool needs a **target**
|
|
21
|
+
Every editing tool needs a **target** telling the API *where* to apply the change. There are three ways to get one:
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
- **From blocks data**: Each block has a `ref` (pass directly to superdoc_edit or superdoc_format) and a `nodeId` (for building `at` positions with superdoc_create).
|
|
24
|
+
- **From superdoc_search**: Returns `handle.ref` covering the matched text. Use search when you need to find text patterns, not when you already know which block to target.
|
|
25
|
+
- **From superdoc_create**: Returns `nodeId` for chaining creates and building block targets. Re-fetch blocks after create to get a fresh ref before formatting.
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
**Refs expire after any mutation.** Always re-search or re-read blocks before the next operation.
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
- `ref` parameter on `superdoc_format` (for inline styles like bold, italic)
|
|
29
|
-
- `ref` parameter on `superdoc_edit` (for text replacement, deletion)
|
|
30
|
-
- Example: `superdoc_format({action: "inline", ref: "text:eyJ...", inline: {bold: true}})`
|
|
31
|
-
- **`address`** — a block-level address like `{ "kind": "block", "nodeType": "paragraph", "nodeId": "abc123" }`. Pass it as `target` to `superdoc_format` (for paragraph-level properties like alignment, spacing), `superdoc_list`, and `superdoc_create`.
|
|
29
|
+
## Common workflows
|
|
32
30
|
|
|
33
|
-
###
|
|
31
|
+
### Replace a word everywhere
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
```
|
|
34
|
+
superdoc_search({select: {type: "text", pattern: "old word"}, require: "all"})
|
|
35
|
+
superdoc_edit({action: "replace", ref: "<handle.ref>", text: "new word"})
|
|
36
|
+
```
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
Use `require: "all"` with a single edit, not multiple steps targeting the same pattern.
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
- `address` — the block address of the matched node
|
|
40
|
+
### Rewrite a full paragraph
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
```
|
|
43
|
+
superdoc_get_content({action: "blocks"})
|
|
44
|
+
// Find the paragraph in the response, use its block ref (covers full text)
|
|
45
|
+
superdoc_edit({action: "replace", ref: "<block.ref>", text: "Entirely new paragraph text."})
|
|
46
|
+
```
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
- `superdoc_get_content` with `action: "text"` returns plain text; `action: "info"` returns document metadata and styles.
|
|
49
|
-
- `superdoc_edit` with `action: "insert"` inserts content; `action: "delete"` deletes content.
|
|
50
|
-
- `superdoc_format` with `action: "inline"` applies inline formatting; `action: "set_style"` applies a named paragraph style.
|
|
48
|
+
A block ref from superdoc_get_content covers the entire block text. A search ref covers only the matched substring. Use block refs when rewriting or shortening whole paragraphs.
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
### Add a new paragraph after a heading
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
```
|
|
53
|
+
superdoc_search({select: {type: "text", pattern: "Introduction"}, require: "first"})
|
|
54
|
+
// Get blockId from result.items[0].blocks[0].blockId
|
|
55
|
+
superdoc_create({action: "paragraph", text: "New content here.", at: {kind: "after", target: {kind: "block", nodeType: "heading", nodeId: "<blockId>"}}})
|
|
56
|
+
// Re-fetch blocks to get a fresh ref for the new paragraph
|
|
57
|
+
superdoc_get_content({action: "blocks", offset: 0, limit: 5})
|
|
58
|
+
// Find the new paragraph in the response, use its ref and nodeId
|
|
59
|
+
// Read formatting from BODY TEXT paragraphs (non-title, alignment "justify" or "left"), not from headings
|
|
60
|
+
superdoc_format({action: "inline", ref: "<new block ref>", inline: {fontFamily: "<from body blocks>", fontSize: <from body blocks>, color: "<from body blocks>", bold: false}})
|
|
61
|
+
superdoc_format({action: "set_alignment", target: {kind: "block", nodeType: "paragraph", nodeId: "<create.nodeId>"}, alignment: "<from body blocks>"})
|
|
62
|
+
```
|
|
55
63
|
|
|
56
|
-
|
|
57
|
-
- Know the document's structure and block IDs for targeting
|
|
58
|
-
- See what fonts, sizes, and styles are used so new content matches
|
|
59
|
-
- Find blocks by their text preview without a separate search
|
|
64
|
+
### Create multiple paragraphs in sequence
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
1. **Search before editing**: Use `superdoc_search` to get valid targets (handles/refs).
|
|
63
|
-
2. **Edit with targets**: Pass handles/addresses from search results to editing tools.
|
|
64
|
-
3. **Re-search after each mutation**: Refs expire after any edit. Always search again before the next operation.
|
|
65
|
-
4. **Batch when possible**: For multi-step edits, prefer `superdoc_mutations`.
|
|
66
|
+
Create all paragraphs first (chaining nodeIds), then re-fetch blocks once and format them all:
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
```
|
|
69
|
+
// Step 1: Create all paragraphs, chaining with nodeId
|
|
70
|
+
superdoc_create({action: "paragraph", text: "First item.", at: {kind: "documentEnd"}})
|
|
71
|
+
// Use nodeId from response for next create
|
|
72
|
+
superdoc_create({action: "paragraph", text: "Second item.", at: {kind: "after", target: {kind: "block", nodeType: "paragraph", nodeId: "<nodeId1>"}}})
|
|
73
|
+
superdoc_create({action: "paragraph", text: "Third item.", at: {kind: "after", target: {kind: "block", nodeType: "paragraph", nodeId: "<nodeId2>"}}})
|
|
68
74
|
|
|
69
|
-
|
|
75
|
+
// Step 2: Re-fetch blocks to get fresh refs for all new paragraphs
|
|
76
|
+
superdoc_get_content({action: "blocks", offset: 0, limit: 10})
|
|
70
77
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
// Step 3: Format each paragraph using fresh refs from blocks
|
|
79
|
+
// Read formatting from BODY TEXT paragraphs (alignment "justify" or "left", not titles)
|
|
80
|
+
superdoc_format({action: "inline", ref: "<fresh ref1>", inline: {fontFamily: "<body>", fontSize: <body>, color: "<body>", bold: false}})
|
|
81
|
+
superdoc_format({action: "set_alignment", target: {kind: "block", nodeType: "paragraph", nodeId: "<nodeId1>"}, alignment: "<body alignment>"})
|
|
82
|
+
// Repeat for each paragraph...
|
|
83
|
+
```
|
|
74
84
|
|
|
75
|
-
|
|
85
|
+
### Bold or format existing text
|
|
76
86
|
|
|
77
|
-
|
|
87
|
+
```
|
|
88
|
+
superdoc_search({select: {type: "text", pattern: "important phrase"}, require: "first"})
|
|
89
|
+
superdoc_format({action: "inline", ref: "<handle.ref>", inline: {bold: true}})
|
|
90
|
+
```
|
|
78
91
|
|
|
79
|
-
|
|
92
|
+
### Set paragraph alignment, spacing, or page breaks
|
|
80
93
|
|
|
81
|
-
|
|
82
|
-
2. **Get the blockId** from `result.items[0].blocks[0].blockId`
|
|
83
|
-
3. **Create content after it**: `superdoc_create({action: "paragraph", text: "...", at: {kind: "after", target: {kind: "block", nodeType: "heading", nodeId: "<blockId>"}}})`
|
|
94
|
+
Paragraph-level actions require a **block target with nodeId**, not a ref:
|
|
84
95
|
|
|
85
|
-
|
|
96
|
+
```
|
|
97
|
+
superdoc_format({action: "set_alignment", target: {kind: "block", nodeType: "paragraph", nodeId: "<nodeId>"}, alignment: "center"})
|
|
98
|
+
superdoc_format({action: "set_flow_options", target: {kind: "block", nodeType: "paragraph", nodeId: "<nodeId>"}, pageBreakBefore: true})
|
|
99
|
+
superdoc_format({action: "set_spacing", target: {kind: "block", nodeType: "paragraph", nodeId: "<nodeId>"}, lineSpacing: {rule: "auto", value: 1.5}})
|
|
100
|
+
```
|
|
86
101
|
|
|
87
|
-
|
|
102
|
+
### Create a bullet or numbered list
|
|
88
103
|
|
|
89
|
-
|
|
104
|
+
1. Create all paragraphs at the SAME location, chaining with previous nodeId:
|
|
105
|
+
```
|
|
106
|
+
superdoc_create({action: "paragraph", text: "Item one", at: {kind: "documentEnd"}})
|
|
107
|
+
superdoc_create({action: "paragraph", text: "Item two", at: {kind: "after", target: {kind: "block", nodeType: "paragraph", nodeId: "<nodeId1>"}}})
|
|
108
|
+
superdoc_create({action: "paragraph", text: "Item three", at: {kind: "after", target: {kind: "block", nodeType: "paragraph", nodeId: "<nodeId2>"}}})
|
|
109
|
+
```
|
|
90
110
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- `args` — operation-specific arguments
|
|
111
|
+
2. Convert the consecutive paragraphs to a list in one call:
|
|
112
|
+
```
|
|
113
|
+
superdoc_list({action: "create", mode: "fromParagraphs", preset: "disc", target: {from: {kind: "block", nodeType: "paragraph", nodeId: "<first>"}, to: {kind: "block", nodeType: "paragraph", nodeId: "<last>"}}})
|
|
114
|
+
```
|
|
96
115
|
|
|
97
|
-
|
|
116
|
+
Use preset "disc" for bullets, "decimal" for numbered. WARNING: the range converts ALL paragraphs between from and to. Make sure no other content exists between them.
|
|
98
117
|
|
|
99
|
-
|
|
118
|
+
3. To change a bullet list to numbered: `superdoc_list({action: "set_type", target: {kind: "block", nodeType: "listItem", nodeId: "<anyItemId>"}, kind: "ordered"})`
|
|
100
119
|
|
|
101
|
-
|
|
102
|
-
1. **Text mutations first** — all `text.rewrite`, `text.insert`, `text.delete` operations in one `superdoc_mutations` call.
|
|
103
|
-
2. **Formatting second** — all `format.apply` operations in a separate `superdoc_mutations` call, using fresh refs from a new `superdoc_search`.
|
|
120
|
+
### Batch multiple text edits atomically
|
|
104
121
|
|
|
105
|
-
|
|
122
|
+
Use superdoc_mutations when you need 2+ text changes that must succeed or fail together:
|
|
106
123
|
|
|
107
|
-
|
|
124
|
+
```
|
|
125
|
+
superdoc_mutations({
|
|
126
|
+
action: "apply", atomic: true, changeMode: "direct",
|
|
127
|
+
steps: [
|
|
128
|
+
{id: "s1", op: "text.rewrite", where: {by: "select", select: {type: "text", pattern: "old term"}, require: "all"}, args: {replacement: {text: "new term"}}},
|
|
129
|
+
{id: "s2", op: "text.delete", where: {by: "select", select: {type: "text", pattern: " (deprecated)"}, require: "all"}, args: {}},
|
|
130
|
+
{id: "s3", op: "text.insert", where: {by: "select", select: {type: "text", pattern: "Section Title"}, require: "first"}, args: {position: "after", content: {text: " (Updated)"}}}
|
|
131
|
+
]
|
|
132
|
+
})
|
|
133
|
+
```
|
|
108
134
|
|
|
109
|
-
|
|
135
|
+
Split mutations by phase: text mutations (text.rewrite, text.insert, text.delete) in one call, then formatting (format.apply) in a separate call with fresh refs from a new superdoc_search.
|
|
110
136
|
|
|
111
|
-
|
|
112
|
-
- **`update`** — Patch fields on an existing comment: change text, move the anchor target, toggle `isInternal`, or update the `status` field.
|
|
113
|
-
- **`delete`** — Remove a comment or reply by ID.
|
|
114
|
-
- **`get`** — Retrieve a single comment thread by ID, including replies.
|
|
115
|
-
- **`list`** — List all comment threads in the document.
|
|
137
|
+
Never create two steps targeting overlapping text in the same block. Combine them into a single text.rewrite instead.
|
|
116
138
|
|
|
117
|
-
###
|
|
139
|
+
### Add a comment on specific text
|
|
118
140
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})
|
|
128
|
-
```
|
|
141
|
+
```
|
|
142
|
+
superdoc_search({select: {type: "text", pattern: "target phrase"}, require: "first"})
|
|
143
|
+
superdoc_comment({
|
|
144
|
+
action: "create",
|
|
145
|
+
text: "Please review this section.",
|
|
146
|
+
target: {kind: "text", blockId: "<blocks[0].blockId>", range: {start: <highlightRange.start>, end: <highlightRange.end>}}
|
|
147
|
+
})
|
|
148
|
+
```
|
|
129
149
|
|
|
130
|
-
|
|
150
|
+
Only pass `action`, `text`, and `target` when creating a new top-level comment. For threaded replies, add `parentId`.
|
|
151
|
+
|
|
152
|
+
### Accept or reject tracked changes
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
superdoc_track_changes({action: "list"})
|
|
156
|
+
// Review changes, then accept or reject
|
|
157
|
+
superdoc_track_changes({action: "decide", decision: "accept", target: {id: "<changeId>"}})
|
|
158
|
+
// Or accept all at once
|
|
159
|
+
superdoc_track_changes({action: "decide", decision: "accept", target: {scope: "all"}})
|
|
160
|
+
```
|
|
131
161
|
|
|
132
|
-
###
|
|
162
|
+
### Match existing document formatting (CRITICAL)
|
|
133
163
|
|
|
134
|
-
|
|
164
|
+
When creating content "like" or "similar to" existing content:
|
|
135
165
|
|
|
136
|
-
|
|
166
|
+
1. Read blocks to get exact formatting properties of the reference content
|
|
167
|
+
2. Use the same nodeType. Title blocks are often bold+underline paragraphs, not heading nodes. Check the blocks data.
|
|
168
|
+
3. Copy ALL formatting exactly: bold, underline, fontSize, fontFamily, color, alignment
|
|
137
169
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
- **
|
|
143
|
-
- **
|
|
144
|
-
- **
|
|
145
|
-
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
170
|
+
### Choosing formatting values (CRITICAL)
|
|
171
|
+
|
|
172
|
+
When formatting newly created content, use the right source:
|
|
173
|
+
|
|
174
|
+
- **Body text** (paragraphs, lorem ipsum, regular content): Read fontFamily, fontSize, color from non-empty, non-title paragraphs with alignment "justify" or "left". Always set `bold: false` and `underline: false` for body text. Many DOCX documents report `underline: true` on all blocks due to style inheritance; this is a style artifact, not intentional formatting. Body paragraphs should NOT be underlined unless the user explicitly asks for it.
|
|
175
|
+
- **Headings/titles**: Read from existing heading or title blocks (centered, bold, possibly underline). Scale fontSize up from body text.
|
|
176
|
+
- **Signature/form fields**: Use justify or left alignment
|
|
177
|
+
- When the user says "heading", use `action: "heading"` with a level, even if the document uses styled paragraphs as titles.
|
|
178
|
+
|
|
179
|
+
## Constraints
|
|
180
|
+
|
|
181
|
+
- **Format calls must be sequential, one per turn.** Each format call bumps the document revision and invalidates all outstanding refs. Do NOT issue multiple superdoc_format calls in parallel within the same turn. Format one block, then re-fetch if needed for the next block.
|
|
182
|
+
- **set_alignment target must be `{kind: "block", nodeType, nodeId}`.** NEVER use `{kind: "block", start: {kind: "nodeEdge", ...}}` or any selection-like structure. Only the flat block target with nodeType and nodeId is accepted.
|
|
183
|
+
- **Always format ALL created items.** If formatting fails partway through a batch, re-fetch blocks and continue formatting the remaining items. Do not stop after a partial failure.
|
|
184
|
+
- **Search patterns are plain text.** Do not include `#`, `**`, or formatting markers.
|
|
185
|
+
- **`select.type` must be "text" or "node".** To find headings: `{type: "node", nodeType: "heading"}`, NOT `{type: "heading"}`.
|
|
186
|
+
- **`within` scopes to a single block**, not a section. To find text in a section, search the full document.
|
|
187
|
+
- **Table cells are separate blocks.** Search for individual cell values, not patterns spanning multiple cells.
|
|
188
|
+
- **Do NOT combine `limit`/`offset` with `require: "first"` or `require: "exactlyOne"`.** Use `require: "any"` with `limit` for paginated results.
|
|
189
|
+
- **Do NOT hardcode formatting values.** Always read from blocks data and replicate.
|
|
190
|
+
- **Do NOT copy heading/title formatting onto body paragraphs.** Read from body text blocks (alignment "justify" or "left"), not title blocks.
|
package/tools/tools-policy.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"tools": [
|
|
4
4
|
{
|
|
5
5
|
"name": "superdoc_get_content",
|
|
6
|
-
"description": "Read document content.
|
|
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
|
"input_schema": {
|
|
8
8
|
"type": "object",
|
|
9
9
|
"properties": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"name": "superdoc_edit",
|
|
59
|
-
"description": "
|
|
59
|
+
"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.",
|
|
60
60
|
"input_schema": {
|
|
61
61
|
"type": "object",
|
|
62
62
|
"properties": {
|
|
@@ -278,7 +278,7 @@
|
|
|
278
278
|
]
|
|
279
279
|
}
|
|
280
280
|
],
|
|
281
|
-
"description": "Target address
|
|
281
|
+
"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>'}."
|
|
282
282
|
},
|
|
283
283
|
"value": {
|
|
284
284
|
"type": "string",
|
|
@@ -295,7 +295,7 @@
|
|
|
295
295
|
},
|
|
296
296
|
"ref": {
|
|
297
297
|
"type": "string",
|
|
298
|
-
"description": "Handle ref
|
|
298
|
+
"description": "Handle ref from superdoc_search result (pass handle.ref value directly). Preferred over building a target object."
|
|
299
299
|
},
|
|
300
300
|
"content": {
|
|
301
301
|
"oneOf": [
|
|
@@ -335,22 +335,6 @@
|
|
|
335
335
|
},
|
|
336
336
|
"description": "Controls nesting behavior. tables: 'allow' permits inserting tables inside other tables. Only for actions 'insert', 'replace'. Omit for other actions."
|
|
337
337
|
},
|
|
338
|
-
"blockId": {
|
|
339
|
-
"type": "string",
|
|
340
|
-
"description": "Block ID of the target paragraph."
|
|
341
|
-
},
|
|
342
|
-
"start": {
|
|
343
|
-
"type": "number",
|
|
344
|
-
"description": "Start offset within the block (character index)."
|
|
345
|
-
},
|
|
346
|
-
"end": {
|
|
347
|
-
"type": "number",
|
|
348
|
-
"description": "End offset within the block (character index)."
|
|
349
|
-
},
|
|
350
|
-
"offset": {
|
|
351
|
-
"type": "number",
|
|
352
|
-
"description": "Character offset for insertion (alias for --start/--end with same value). Only for action 'insert'. Omit for other actions."
|
|
353
|
-
},
|
|
354
338
|
"text": {
|
|
355
339
|
"type": "string",
|
|
356
340
|
"description": "Replacement text content. Only for action 'replace'. Omit for other actions."
|
|
@@ -372,7 +356,7 @@
|
|
|
372
356
|
},
|
|
373
357
|
{
|
|
374
358
|
"name": "superdoc_format",
|
|
375
|
-
"description": "Change text and paragraph formatting. Use
|
|
359
|
+
"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.",
|
|
376
360
|
"input_schema": {
|
|
377
361
|
"type": "object",
|
|
378
362
|
"properties": {
|
|
@@ -382,11 +366,12 @@
|
|
|
382
366
|
"inline",
|
|
383
367
|
"set_alignment",
|
|
384
368
|
"set_direction",
|
|
369
|
+
"set_flow_options",
|
|
385
370
|
"set_indentation",
|
|
386
371
|
"set_spacing",
|
|
387
372
|
"set_style"
|
|
388
373
|
],
|
|
389
|
-
"description": "The action to perform. One of: inline, set_alignment, set_direction, set_indentation, set_spacing, set_style."
|
|
374
|
+
"description": "The action to perform. One of: inline, set_alignment, set_direction, set_flow_options, set_indentation, set_spacing, set_style."
|
|
390
375
|
},
|
|
391
376
|
"force": {
|
|
392
377
|
"type": "boolean",
|
|
@@ -561,7 +546,7 @@
|
|
|
561
546
|
"start",
|
|
562
547
|
"end"
|
|
563
548
|
],
|
|
564
|
-
"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'."
|
|
549
|
+
"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'."
|
|
565
550
|
},
|
|
566
551
|
"inline": {
|
|
567
552
|
"type": "object",
|
|
@@ -879,6 +864,18 @@
|
|
|
879
864
|
"atLeast"
|
|
880
865
|
]
|
|
881
866
|
},
|
|
867
|
+
"contextualSpacing": {
|
|
868
|
+
"type": "boolean",
|
|
869
|
+
"description": "Only for action 'set_flow_options'. Omit for other actions."
|
|
870
|
+
},
|
|
871
|
+
"pageBreakBefore": {
|
|
872
|
+
"type": "boolean",
|
|
873
|
+
"description": "Only for action 'set_flow_options'. Omit for other actions."
|
|
874
|
+
},
|
|
875
|
+
"suppressAutoHyphens": {
|
|
876
|
+
"type": "boolean",
|
|
877
|
+
"description": "Only for action 'set_flow_options'. Omit for other actions."
|
|
878
|
+
},
|
|
882
879
|
"direction": {
|
|
883
880
|
"type": "string",
|
|
884
881
|
"enum": [
|
|
@@ -904,7 +901,7 @@
|
|
|
904
901
|
},
|
|
905
902
|
{
|
|
906
903
|
"name": "superdoc_create",
|
|
907
|
-
"description": "Create
|
|
904
|
+
"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.",
|
|
908
905
|
"input_schema": {
|
|
909
906
|
"type": "object",
|
|
910
907
|
"properties": {
|
|
@@ -912,9 +909,10 @@
|
|
|
912
909
|
"type": "string",
|
|
913
910
|
"enum": [
|
|
914
911
|
"heading",
|
|
915
|
-
"paragraph"
|
|
912
|
+
"paragraph",
|
|
913
|
+
"table"
|
|
916
914
|
],
|
|
917
|
-
"description": "The action to perform. One of: heading, paragraph."
|
|
915
|
+
"description": "The action to perform. One of: heading, paragraph, table."
|
|
918
916
|
},
|
|
919
917
|
"force": {
|
|
920
918
|
"type": "boolean",
|
|
@@ -1058,6 +1056,14 @@
|
|
|
1058
1056
|
"level": {
|
|
1059
1057
|
"type": "number",
|
|
1060
1058
|
"description": "Heading level (1-6). Required for action 'heading'."
|
|
1059
|
+
},
|
|
1060
|
+
"rows": {
|
|
1061
|
+
"type": "number",
|
|
1062
|
+
"description": "Required for action 'table'."
|
|
1063
|
+
},
|
|
1064
|
+
"columns": {
|
|
1065
|
+
"type": "number",
|
|
1066
|
+
"description": "Required for action 'table'."
|
|
1061
1067
|
}
|
|
1062
1068
|
},
|
|
1063
1069
|
"required": [
|
|
@@ -1068,7 +1074,7 @@
|
|
|
1068
1074
|
},
|
|
1069
1075
|
{
|
|
1070
1076
|
"name": "superdoc_list",
|
|
1071
|
-
"description": "Create and manipulate lists",
|
|
1077
|
+
"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.",
|
|
1072
1078
|
"input_schema": {
|
|
1073
1079
|
"type": "object",
|
|
1074
1080
|
"properties": {
|
|
@@ -1322,7 +1328,7 @@
|
|
|
1322
1328
|
},
|
|
1323
1329
|
{
|
|
1324
1330
|
"name": "superdoc_comment",
|
|
1325
|
-
"description": "
|
|
1331
|
+
"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.",
|
|
1326
1332
|
"input_schema": {
|
|
1327
1333
|
"type": "object",
|
|
1328
1334
|
"properties": {
|
|
@@ -1426,7 +1432,7 @@
|
|
|
1426
1432
|
},
|
|
1427
1433
|
{
|
|
1428
1434
|
"name": "superdoc_track_changes",
|
|
1429
|
-
"description": "Review and resolve tracked changes",
|
|
1435
|
+
"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.",
|
|
1430
1436
|
"input_schema": {
|
|
1431
1437
|
"type": "object",
|
|
1432
1438
|
"properties": {
|
|
@@ -1513,7 +1519,7 @@
|
|
|
1513
1519
|
},
|
|
1514
1520
|
{
|
|
1515
1521
|
"name": "superdoc_search",
|
|
1516
|
-
"description": "Find text or nodes in the document",
|
|
1522
|
+
"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.",
|
|
1517
1523
|
"input_schema": {
|
|
1518
1524
|
"type": "object",
|
|
1519
1525
|
"properties": {
|
|
@@ -1668,7 +1674,7 @@
|
|
|
1668
1674
|
},
|
|
1669
1675
|
{
|
|
1670
1676
|
"name": "superdoc_mutations",
|
|
1671
|
-
"description": "
|
|
1677
|
+
"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.",
|
|
1672
1678
|
"input_schema": {
|
|
1673
1679
|
"type": "object",
|
|
1674
1680
|
"properties": {
|