@tiwater/office-mcp 0.17.7 → 0.17.8
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
|
@@ -173,7 +173,10 @@ function docxInspectionOutput(tool) {
|
|
|
173
173
|
revision: docxRevision,
|
|
174
174
|
summary: z.object({
|
|
175
175
|
tableCount: z.number().int().nonnegative(),
|
|
176
|
-
|
|
176
|
+
openingParagraphs: z.array(z.object({
|
|
177
|
+
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
178
|
+
textPreview: z.string().min(1).max(240),
|
|
179
|
+
}).strict()).max(6),
|
|
177
180
|
}).strict(),
|
|
178
181
|
}).strict();
|
|
179
182
|
}
|
|
@@ -238,7 +241,7 @@ const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
|
|
|
238
241
|
const tools = [
|
|
239
242
|
{
|
|
240
243
|
name: 'docx_inspect',
|
|
241
|
-
description: 'Inspect one current DOCX. The response returns its revision, table count, and
|
|
244
|
+
description: 'Inspect one current DOCX. The response returns its revision, table count, and up to six opening non-empty body paragraphs with native refs for document identification and immediate reuse; use docx_find_literal for other text and docx_list_objects for container children. The complete inspection remains in the evidence artifact.',
|
|
242
245
|
inputSchema: inputContract('docx_inspect'),
|
|
243
246
|
outputSchema: docxInspectionOutput('docx_inspect'),
|
|
244
247
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -505,13 +508,18 @@ function compactDocxInspection(report) {
|
|
|
505
508
|
if (!report?.tables?.revision || !Array.isArray(report.tables.tables) || !Array.isArray(report.flow)) {
|
|
506
509
|
throw new Error('docx-table-inspection-result-invalid');
|
|
507
510
|
}
|
|
508
|
-
const
|
|
509
|
-
.filter(item => item?.type === 'paragraph'
|
|
511
|
+
const openingParagraphs = report.flow
|
|
512
|
+
.filter(item => item?.type === 'paragraph'
|
|
513
|
+
&& /^dox1_[0-9a-f]{64}$/u.test(item.objectRef)
|
|
514
|
+
&& typeof item.text === 'string' && item.text.trim())
|
|
510
515
|
.slice(0, 6)
|
|
511
|
-
.map(item =>
|
|
516
|
+
.map(item => ({
|
|
517
|
+
ref: item.objectRef,
|
|
518
|
+
textPreview: item.text.trim().replace(/\s+/gu, ' ').slice(0, 240),
|
|
519
|
+
}));
|
|
512
520
|
return {
|
|
513
521
|
revision: report.tables.revision,
|
|
514
|
-
summary: { tableCount: report.tables.tables.length,
|
|
522
|
+
summary: { tableCount: report.tables.tables.length, openingParagraphs },
|
|
515
523
|
};
|
|
516
524
|
}
|
|
517
525
|
|