@tiwater/office-mcp 0.17.28 → 0.17.29
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,17 +173,6 @@ function docxInspectionOutput(tool) {
|
|
|
173
173
|
revision: docxRevision,
|
|
174
174
|
summary: z.object({
|
|
175
175
|
tableCount: z.number().int().nonnegative(),
|
|
176
|
-
tables: z.array(z.object({
|
|
177
|
-
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
178
|
-
parentRef: z.string().regex(/^dox1_[0-9a-f]{64}$/).nullable(),
|
|
179
|
-
rowCount: z.number().int().nonnegative(),
|
|
180
|
-
columnCount: z.number().int().nonnegative(),
|
|
181
|
-
textPreview: z.string().max(240),
|
|
182
|
-
contextBefore: z.array(z.object({
|
|
183
|
-
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
184
|
-
textPreview: z.string().min(1).max(240),
|
|
185
|
-
}).strict()).max(3),
|
|
186
|
-
}).strict()),
|
|
187
176
|
openingParagraphs: z.array(z.object({
|
|
188
177
|
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
189
178
|
textPreview: z.string().min(1).max(240),
|
|
@@ -252,7 +241,7 @@ const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
|
|
|
252
241
|
const tools = [
|
|
253
242
|
{
|
|
254
243
|
name: 'docx_inspect',
|
|
255
|
-
description: 'Inspect one current DOCX
|
|
244
|
+
description: 'Inspect one current DOCX and retain its complete machine observation at output. The response returns the current revision, observation artifact, table count, and up to six opening non-empty body paragraphs for document identity. Use bounded list, find, and read operations for selected document objects.',
|
|
256
245
|
inputSchema: inputContract('docx_inspect'),
|
|
257
246
|
outputSchema: docxInspectionOutput('docx_inspect'),
|
|
258
247
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -528,34 +517,10 @@ function compactDocxInspection(report) {
|
|
|
528
517
|
ref: item.objectRef,
|
|
529
518
|
textPreview: item.text.trim().replace(/\s+/gu, ' ').slice(0, 240),
|
|
530
519
|
}));
|
|
531
|
-
const tableContexts = new Map();
|
|
532
|
-
let precedingParagraphs = [];
|
|
533
|
-
for (const item of report.flow) {
|
|
534
|
-
if (item?.type === 'paragraph' && /^dox1_[0-9a-f]{64}$/u.test(item.objectRef)
|
|
535
|
-
&& typeof item.text === 'string' && item.text.trim()) {
|
|
536
|
-
precedingParagraphs.push({
|
|
537
|
-
ref: item.objectRef,
|
|
538
|
-
textPreview: item.text.trim().replace(/\s+/gu, ' ').slice(0, 240),
|
|
539
|
-
});
|
|
540
|
-
precedingParagraphs = precedingParagraphs.slice(-3);
|
|
541
|
-
}
|
|
542
|
-
if (item?.type === 'table' && Number.isInteger(item.tableIndex)) {
|
|
543
|
-
tableContexts.set(item.tableIndex, precedingParagraphs);
|
|
544
|
-
precedingParagraphs = [];
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
520
|
return {
|
|
548
521
|
revision: report.tables.revision,
|
|
549
522
|
summary: {
|
|
550
523
|
tableCount: report.tables.tables.length,
|
|
551
|
-
tables: report.tables.tables.map((table, tableIndex) => ({
|
|
552
|
-
ref: table.ref,
|
|
553
|
-
parentRef: table.parentRef,
|
|
554
|
-
rowCount: table.rowCount,
|
|
555
|
-
columnCount: table.columnCount,
|
|
556
|
-
textPreview: String(table.textPreview ?? '').trim().replace(/\s+/gu, ' ').slice(0, 240),
|
|
557
|
-
contextBefore: tableContexts.get(tableIndex) ?? [],
|
|
558
|
-
})),
|
|
559
524
|
openingParagraphs,
|
|
560
525
|
},
|
|
561
526
|
};
|