@tiwater/office-mcp 0.17.0 → 0.17.2
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 docx_list_objects or docx_find_literal.
|
|
11
|
+
"description": "One object ref returned by docx_list_objects or docx_find_literal. Select the smallest object that contains the needed detail; for a large table, page its rows first and read only the selected rows.",
|
|
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.
|
|
21
|
+
"description": "Object kinds required by the next operation. Include paragraph when paragraph boundaries affect a later content selection.",
|
|
22
22
|
"type": "array",
|
|
23
23
|
"items": {
|
|
24
24
|
"type": "string",
|
|
@@ -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.2"
|
|
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": "1050e1f221ba9bf8e354ae505525d8106e8e29457f49c5562c7bad02fd9b4945"
|
|
145
145
|
},
|
|
146
146
|
"inputContract": {
|
|
147
147
|
"path": "office/contracts/docx_read_object.schema.json",
|
|
148
|
-
"sha256": "
|
|
148
|
+
"sha256": "1050e1f221ba9bf8e354ae505525d8106e8e29457f49c5562c7bad02fd9b4945"
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
151
|
{
|
package/office/index.mjs
CHANGED
|
@@ -198,6 +198,7 @@ const docxObjectIdentity = z.object({
|
|
|
198
198
|
const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
|
|
199
199
|
revision: docxRevision,
|
|
200
200
|
object: docxObjectIdentity,
|
|
201
|
+
objects: z.array(docxObjectIdentity).min(1),
|
|
201
202
|
}).strict();
|
|
202
203
|
|
|
203
204
|
const tools = [
|
|
@@ -211,21 +212,21 @@ const tools = [
|
|
|
211
212
|
},
|
|
212
213
|
{
|
|
213
214
|
name: 'docx_list_objects',
|
|
214
|
-
description: 'List one small page of revision-bound DOCX object identities
|
|
215
|
+
description: 'List one small page of revision-bound DOCX object identities. Use parentRef to page a selected table\'s rows; use docx_find_literal when selecting by text.',
|
|
215
216
|
inputSchema: inputContract('docx_list_objects'),
|
|
216
217
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
217
218
|
handler: args => docxObservation('docx_list_objects', args),
|
|
218
219
|
},
|
|
219
220
|
{
|
|
220
221
|
name: 'docx_find_literal',
|
|
221
|
-
description: 'Find exact current text in one small page of revision-bound native DOCX objects. With kind table or row, matching includes
|
|
222
|
+
description: 'Find exact current text in one small page of revision-bound native DOCX objects. With kind table or row, matching includes descendant cell text.',
|
|
222
223
|
inputSchema: inputContract('docx_find_literal'),
|
|
223
224
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
224
225
|
handler: args => docxObservation('docx_find_literal', args),
|
|
225
226
|
},
|
|
226
227
|
{
|
|
227
228
|
name: 'docx_read_object',
|
|
228
|
-
description: 'Read one selected native DOCX object
|
|
229
|
+
description: 'Read one selected native DOCX object and requested descendants. Select the smallest useful object; for a large table, page rows with docx_list_objects and read only the selected rows.',
|
|
229
230
|
inputSchema: inputContract('docx_read_object'),
|
|
230
231
|
outputSchema: docxReadObjectOutput,
|
|
231
232
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -482,6 +483,17 @@ function compactDocxObjectIdentity(object) {
|
|
|
482
483
|
};
|
|
483
484
|
}
|
|
484
485
|
|
|
486
|
+
function compactDocxObservationObjects(observation) {
|
|
487
|
+
const objects = [];
|
|
488
|
+
function visit(node) {
|
|
489
|
+
if (!node?.object) return;
|
|
490
|
+
objects.push(compactDocxObjectIdentity(node.object));
|
|
491
|
+
for (const child of node.children ?? []) visit(child);
|
|
492
|
+
}
|
|
493
|
+
visit(observation);
|
|
494
|
+
return objects;
|
|
495
|
+
}
|
|
496
|
+
|
|
485
497
|
async function docxInspect(args) {
|
|
486
498
|
const input = path.resolve(requireString(args.input, 'input'));
|
|
487
499
|
const result = await runJsonCandidateChain(docxCandidates, ['inspect', input, '--json']);
|
|
@@ -514,6 +526,7 @@ async function docxReadObject(args) {
|
|
|
514
526
|
artifact: await writeJsonArtifact(output, result.json),
|
|
515
527
|
revision: result.json.receipt.revision,
|
|
516
528
|
object: compactDocxObjectIdentity(result.json.observation.object),
|
|
529
|
+
objects: compactDocxObservationObjects(result.json.observation),
|
|
517
530
|
};
|
|
518
531
|
});
|
|
519
532
|
}
|