@tiwater/office-mcp 0.17.0 → 0.17.1
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/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 = [
|
|
@@ -225,7 +226,7 @@ const tools = [
|
|
|
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. The response returns the selected root and requested descendants as ordered object identities for the next operation; the complete hierarchy remains in the evidence artifact. For a table, request row, cell, and paragraph once when row bounds, header columns, and paragraph choices are all needed.',
|
|
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
|
}
|