@tiwater/office-mcp 0.17.7 → 0.17.9
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. Read a complete small or medium table once; page rows only when the complete table is too large for one response.",
|
|
12
12
|
"type": "string",
|
|
13
13
|
"pattern": "^dox1_[0-9a-f]{64}$"
|
|
14
14
|
},
|
|
@@ -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.9"
|
|
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": "662e3b64dfefcab36f05c123b7f6144b9942a2f7c7b34e40c9bebcb16171b09d"
|
|
145
145
|
},
|
|
146
146
|
"inputContract": {
|
|
147
147
|
"path": "office/contracts/docx_read_object.schema.json",
|
|
148
|
-
"sha256": "
|
|
148
|
+
"sha256": "662e3b64dfefcab36f05c123b7f6144b9942a2f7c7b34e40c9bebcb16171b09d"
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
151
|
{
|
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 },
|
|
@@ -262,7 +265,7 @@ const tools = [
|
|
|
262
265
|
},
|
|
263
266
|
{
|
|
264
267
|
name: 'docx_read_object',
|
|
265
|
-
description: 'Read one selected native DOCX object and requested descendants.
|
|
268
|
+
description: 'Read one selected native DOCX object and requested descendants. Read a complete small or medium table once with row, cell, and paragraph descendants; add run or text only for an exact inline selection. Page rows only when the complete table is too large for one response.',
|
|
266
269
|
inputSchema: inputContract('docx_read_object'),
|
|
267
270
|
outputSchema: docxReadObjectOutput,
|
|
268
271
|
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
|
|