@tiwater/office-mcp 0.17.4 → 0.17.5
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
|
@@ -168,21 +168,12 @@ const docxRevision = z.object({
|
|
|
168
168
|
toolVersion: z.string(),
|
|
169
169
|
}).strict();
|
|
170
170
|
|
|
171
|
-
const docxTableIndexEntry = z.object({
|
|
172
|
-
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
173
|
-
parentRef: z.string().regex(/^dox1_[0-9a-f]{64}$/).nullable(),
|
|
174
|
-
storyPart: z.string(),
|
|
175
|
-
nativePath: z.string(),
|
|
176
|
-
rowCount: z.number().int().nonnegative(),
|
|
177
|
-
columnCount: z.number().int().nonnegative(),
|
|
178
|
-
textPreview: z.string(),
|
|
179
|
-
textLength: z.number().int().nonnegative(),
|
|
180
|
-
}).strict();
|
|
181
|
-
|
|
182
171
|
function docxInspectionOutput(tool) {
|
|
183
172
|
return artifactOutput(tool).extend({
|
|
184
173
|
revision: docxRevision,
|
|
185
|
-
|
|
174
|
+
summary: z.object({
|
|
175
|
+
tableCount: z.number().int().nonnegative(),
|
|
176
|
+
}).strict(),
|
|
186
177
|
}).strict();
|
|
187
178
|
}
|
|
188
179
|
|
|
@@ -234,7 +225,7 @@ const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
|
|
|
234
225
|
const tools = [
|
|
235
226
|
{
|
|
236
227
|
name: 'docx_inspect',
|
|
237
|
-
description: 'Inspect one current DOCX. The response returns its revision and
|
|
228
|
+
description: 'Inspect one current DOCX. The response returns its revision and table count; use paged docx_find_literal or docx_list_objects to select native objects. The complete inspection remains in the evidence artifact.',
|
|
238
229
|
inputSchema: inputContract('docx_inspect'),
|
|
239
230
|
outputSchema: docxInspectionOutput('docx_inspect'),
|
|
240
231
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -497,11 +488,11 @@ function buildServer() {
|
|
|
497
488
|
return server;
|
|
498
489
|
}
|
|
499
490
|
|
|
500
|
-
function
|
|
491
|
+
function compactDocxInspection(report) {
|
|
501
492
|
if (!report?.revision || !Array.isArray(report.tables)) {
|
|
502
493
|
throw new Error('docx-table-inspection-result-invalid');
|
|
503
494
|
}
|
|
504
|
-
return { revision: report.revision,
|
|
495
|
+
return { revision: report.revision, summary: { tableCount: report.tables.length } };
|
|
505
496
|
}
|
|
506
497
|
|
|
507
498
|
function compactDocxObjectIdentity(object) {
|
|
@@ -534,7 +525,7 @@ async function docxInspect(args) {
|
|
|
534
525
|
runtime: commandRuntime(result),
|
|
535
526
|
source: await fileArtifact(input),
|
|
536
527
|
artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
|
|
537
|
-
...
|
|
528
|
+
...compactDocxInspection(result.json.tables),
|
|
538
529
|
};
|
|
539
530
|
}
|
|
540
531
|
|