@tiwater/office-mcp 0.17.11 → 0.17.13
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.
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"x-tiwater-file-role": "read"
|
|
9
9
|
},
|
|
10
10
|
"ref": {
|
|
11
|
-
"description": "One object ref returned by
|
|
11
|
+
"description": "One object ref returned by a current DOCX observation. Read table structure through paragraph descendants first. For exact inline content, use an observed cell or paragraph ref; table-rooted run/text reads are rejected.",
|
|
12
12
|
"type": "string",
|
|
13
13
|
"pattern": "^dox1_[0-9a-f]{64}$"
|
|
14
14
|
},
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"pattern": "^docx-rev-v1-[0-9a-f]{64}$"
|
|
19
19
|
},
|
|
20
20
|
"kinds": {
|
|
21
|
-
"description": "Object kinds required by the next operation. Include paragraph
|
|
21
|
+
"description": "Object kinds required by the next operation. Include paragraph for table content boundaries. Request run or text only when ref identifies a cell or paragraph, never a whole table.",
|
|
22
22
|
"type": "array",
|
|
23
23
|
"items": {
|
|
24
24
|
"type": "string",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"targetRef": {
|
|
22
22
|
"type": "string",
|
|
23
23
|
"pattern": "^dox1_[0-9a-f]{64}$",
|
|
24
|
-
"description": "Observed
|
|
24
|
+
"description": "Observed paragraph or cell ref whose whole text content is replaced. Bookmarks and target formatting are preserved; tabs and line breaks are written as native OpenXML text controls. Targets containing fields, drawings, nested tables, controls, links, or other non-text content are rejected."
|
|
25
25
|
},
|
|
26
26
|
"text": { "type": "string" }
|
|
27
27
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schema": "tiwater.office-provider-contract-manifest/v1",
|
|
3
3
|
"provider": {
|
|
4
4
|
"id": "@tiwater/office-mcp",
|
|
5
|
-
"version": "0.17.
|
|
5
|
+
"version": "0.17.13"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
@@ -141,11 +141,11 @@
|
|
|
141
141
|
"name": "docx_read_object",
|
|
142
142
|
"providerContract": {
|
|
143
143
|
"source": "packages/docx-cli/contracts/mcp-input/docx_read_object.schema.json",
|
|
144
|
-
"sha256": "
|
|
144
|
+
"sha256": "1b92b5620f0f76f47b7a9550d79d414f5e0a76cb37a7c4c2615e02e32cf9a02c"
|
|
145
145
|
},
|
|
146
146
|
"inputContract": {
|
|
147
147
|
"path": "office/contracts/docx_read_object.schema.json",
|
|
148
|
-
"sha256": "
|
|
148
|
+
"sha256": "1b92b5620f0f76f47b7a9550d79d414f5e0a76cb37a7c4c2615e02e32cf9a02c"
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
151
|
{
|
|
@@ -174,11 +174,11 @@
|
|
|
174
174
|
"name": "docx_set_text",
|
|
175
175
|
"providerContract": {
|
|
176
176
|
"source": "packages/docx-cli/contracts/mcp-input/docx_set_text.schema.json",
|
|
177
|
-
"sha256": "
|
|
177
|
+
"sha256": "f66adf07e6e53599d93ad29420d7a977d869371ef3e0759a128fb2333f8daf08"
|
|
178
178
|
},
|
|
179
179
|
"inputContract": {
|
|
180
180
|
"path": "office/contracts/docx_set_text.schema.json",
|
|
181
|
-
"sha256": "
|
|
181
|
+
"sha256": "f66adf07e6e53599d93ad29420d7a977d869371ef3e0759a128fb2333f8daf08"
|
|
182
182
|
}
|
|
183
183
|
},
|
|
184
184
|
{
|
package/office/index.mjs
CHANGED
|
@@ -265,7 +265,7 @@ const tools = [
|
|
|
265
265
|
},
|
|
266
266
|
{
|
|
267
267
|
name: 'docx_read_object',
|
|
268
|
-
description: 'Read one selected native DOCX object and requested descendants.
|
|
268
|
+
description: 'Read one selected native DOCX object and requested descendants. For a table, read row, cell, and paragraph descendants first. To select exact inline content, make a second read rooted at the observed cell or paragraph and request run or text; table-rooted inline reads are rejected so one call cannot return the document-wide character tree.',
|
|
269
269
|
inputSchema: inputContract('docx_read_object'),
|
|
270
270
|
outputSchema: docxReadObjectOutput,
|
|
271
271
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -280,7 +280,7 @@ const tools = [
|
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
282
|
name: 'docx_set_text',
|
|
283
|
-
description: 'Replace the whole text content of observed
|
|
283
|
+
description: 'Replace the whole text content of observed paragraph or cell objects while retaining target formatting and bookmarks. Tabs and line breaks remain native document text controls; targets containing non-text objects are rejected. This sets already-derived text; it does not insert objects, copy source formatting, or decide business wording.',
|
|
284
284
|
inputSchema: inputContract('docx_set_text'),
|
|
285
285
|
outputSchema: fixedEditOutput('docx_set_text'),
|
|
286
286
|
handler: args => fixedEdit('docx_set_text', args),
|
|
@@ -538,14 +538,14 @@ function compactDocxObservation(observation) {
|
|
|
538
538
|
if (!observation?.object) throw new Error('docx-read-object-missing-observation');
|
|
539
539
|
function compactNode(node) {
|
|
540
540
|
const identity = compactDocxObjectIdentity(node.object);
|
|
541
|
+
const children = (node.children ?? []).map(compactNode);
|
|
541
542
|
const object = {
|
|
542
543
|
ref: identity.ref,
|
|
543
544
|
kind: identity.kind,
|
|
544
|
-
textPreview: identity.textPreview,
|
|
545
|
+
textPreview: children.length === 0 ? identity.textPreview : null,
|
|
545
546
|
...(identity.gridSpan === null ? {} : { gridSpan: identity.gridSpan }),
|
|
546
547
|
...(identity.verticalMerge === null ? {} : { verticalMerge: identity.verticalMerge }),
|
|
547
548
|
};
|
|
548
|
-
const children = (node.children ?? []).map(compactNode);
|
|
549
549
|
return {
|
|
550
550
|
object,
|
|
551
551
|
...(children.length === 0 ? {} : { children }),
|
|
@@ -602,6 +602,10 @@ async function docxReadObject(args) {
|
|
|
602
602
|
const { output: _output, ...request } = args;
|
|
603
603
|
return withTempJsonFile(request, async requestPath => {
|
|
604
604
|
const result = await runJsonCandidateChain(docxCandidates, ['docx_read_object', requestPath]);
|
|
605
|
+
if (result.json?.observation?.object?.kind === 'table'
|
|
606
|
+
&& args.kinds.some(kind => kind === 'run' || kind === 'text')) {
|
|
607
|
+
throw new Error('docx-table-inline-detail-requires-cell-or-paragraph-root');
|
|
608
|
+
}
|
|
605
609
|
return {
|
|
606
610
|
tool: 'docx_read_object',
|
|
607
611
|
runtime: commandRuntime(result),
|