@tiwater/office-mcp 0.18.8 → 0.18.10
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.
|
@@ -14,6 +14,18 @@
|
|
|
14
14
|
"minLength": 1,
|
|
15
15
|
"description": "New JSON artifact path for the complete table index.",
|
|
16
16
|
"x-tiwater-file-role": "write"
|
|
17
|
+
},
|
|
18
|
+
"limit": {
|
|
19
|
+
"type": "integer",
|
|
20
|
+
"minimum": 1,
|
|
21
|
+
"maximum": 1000,
|
|
22
|
+
"description": "Maximum number of table summaries requested in this response page. The provider may return fewer to keep the machine response bounded."
|
|
23
|
+
},
|
|
24
|
+
"offset": {
|
|
25
|
+
"type": "integer",
|
|
26
|
+
"minimum": 0,
|
|
27
|
+
"maximum": 9007199254740991,
|
|
28
|
+
"description": "Zero-based table offset. Continue from receipt.nextOffset until it is null."
|
|
17
29
|
}
|
|
18
30
|
},
|
|
19
31
|
"required": ["input", "output"],
|
|
@@ -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.18.
|
|
5
|
+
"version": "0.18.10"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
@@ -207,11 +207,11 @@
|
|
|
207
207
|
"name": "docx_table_index",
|
|
208
208
|
"providerContract": {
|
|
209
209
|
"source": "packages/docx-cli/contracts/mcp-input/docx_table_index.schema.json",
|
|
210
|
-
"sha256": "
|
|
210
|
+
"sha256": "e10ea5780559f269b6fa193aadb0fc0793009e5e7a4047a7a46aa5621dfeaac1"
|
|
211
211
|
},
|
|
212
212
|
"inputContract": {
|
|
213
213
|
"path": "office/contracts/docx_table_index.schema.json",
|
|
214
|
-
"sha256": "
|
|
214
|
+
"sha256": "e10ea5780559f269b6fa193aadb0fc0793009e5e7a4047a7a46aa5621dfeaac1"
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
217
|
{
|
package/office/index.mjs
CHANGED
|
@@ -218,6 +218,13 @@ const docxListObjectsOutput = artifactOutput('docx_list_objects').extend({
|
|
|
218
218
|
|
|
219
219
|
const docxTableIndexOutput = artifactOutput('docx_table_index').extend({
|
|
220
220
|
schema: z.literal('tiwater.docx-table-index/v1'),
|
|
221
|
+
receipt: z.object({
|
|
222
|
+
schema: z.literal('tiwater.docx-table-index-receipt/v1'),
|
|
223
|
+
totalCount: z.number().int().nonnegative(),
|
|
224
|
+
returnedCount: z.number().int().nonnegative(),
|
|
225
|
+
remaining: z.number().int().nonnegative(),
|
|
226
|
+
nextOffset: z.number().int().nonnegative().nullable(),
|
|
227
|
+
}).strict(),
|
|
221
228
|
tables: z.array(z.object({
|
|
222
229
|
address: docxAddress,
|
|
223
230
|
parentAddress: docxAddress.nullable(),
|
|
@@ -225,6 +232,16 @@ const docxTableIndexOutput = artifactOutput('docx_table_index').extend({
|
|
|
225
232
|
columnCount: z.number().int().nonnegative(),
|
|
226
233
|
textPreview: z.string(),
|
|
227
234
|
textLength: z.number().int().nonnegative(),
|
|
235
|
+
precedingParagraph: z.object({
|
|
236
|
+
address: docxAddress,
|
|
237
|
+
textPreview: z.string(),
|
|
238
|
+
textLength: z.number().int().nonnegative(),
|
|
239
|
+
}).strict().nullable(),
|
|
240
|
+
followingParagraph: z.object({
|
|
241
|
+
address: docxAddress,
|
|
242
|
+
textPreview: z.string(),
|
|
243
|
+
textLength: z.number().int().nonnegative(),
|
|
244
|
+
}).strict().nullable(),
|
|
228
245
|
}).strict()),
|
|
229
246
|
}).strict();
|
|
230
247
|
|
|
@@ -233,6 +250,16 @@ const docxTableReadOutput = artifactOutput('docx_read_table').extend({
|
|
|
233
250
|
address: docxAddress,
|
|
234
251
|
rowCount: z.number().int().nonnegative(),
|
|
235
252
|
columnCount: z.number().int().nonnegative(),
|
|
253
|
+
precedingParagraph: z.object({
|
|
254
|
+
address: docxAddress,
|
|
255
|
+
textPreview: z.string(),
|
|
256
|
+
textLength: z.number().int().nonnegative(),
|
|
257
|
+
}).strict().nullable(),
|
|
258
|
+
followingParagraph: z.object({
|
|
259
|
+
address: docxAddress,
|
|
260
|
+
textPreview: z.string(),
|
|
261
|
+
textLength: z.number().int().nonnegative(),
|
|
262
|
+
}).strict().nullable(),
|
|
236
263
|
rows: z.array(z.object({
|
|
237
264
|
address: docxAddress,
|
|
238
265
|
gridBefore: z.number().int().nonnegative(),
|
|
@@ -276,7 +303,7 @@ const tools = [
|
|
|
276
303
|
},
|
|
277
304
|
{
|
|
278
305
|
name: 'docx_table_index',
|
|
279
|
-
description: 'Locate tables in one current DOCX.
|
|
306
|
+
description: 'Locate tables in one current DOCX. Writes the complete index to output and returns a bounded page containing table address, shape, short text preview, and nearest non-empty paragraphs. Continue with receipt.nextOffset, then call docx_read_table for one selected address. It does not return full cell content or decide table semantics.',
|
|
280
307
|
inputSchema: inputContract('docx_table_index'),
|
|
281
308
|
outputSchema: docxTableIndexOutput,
|
|
282
309
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -292,7 +319,7 @@ const tools = [
|
|
|
292
319
|
},
|
|
293
320
|
{
|
|
294
321
|
name: 'docx_read_table',
|
|
295
|
-
description: 'Read exactly one table selected from docx_table_index by native OpenXML address. Returns its rows, cells, spans, vertical merges, paragraphs, text nodes, and reusable addresses in document order. It does not locate a table or decide business meaning.',
|
|
322
|
+
description: 'Read exactly one table selected from docx_table_index by native OpenXML address. Returns its nearest non-empty paragraph before and after the table, rows, cells, spans, vertical merges, paragraphs, text nodes, and reusable addresses in document order. It does not locate a table or decide business meaning.',
|
|
296
323
|
inputSchema: inputContract('docx_read_table'),
|
|
297
324
|
outputSchema: docxTableReadOutput,
|
|
298
325
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -612,7 +639,31 @@ async function docxObservation(tool, args) {
|
|
|
612
639
|
if (tool === 'docx_list_objects') {
|
|
613
640
|
return { ...retained, ...payload, objects: payload.objects.map(compactDocxObjectIdentity) };
|
|
614
641
|
}
|
|
615
|
-
if (tool === 'docx_table_index'
|
|
642
|
+
if (tool === 'docx_table_index') {
|
|
643
|
+
const totalCount = payload.tables.length;
|
|
644
|
+
const offset = Math.min(args.offset ?? 0, totalCount);
|
|
645
|
+
const requestedLimit = args.limit ?? totalCount;
|
|
646
|
+
const tables = [];
|
|
647
|
+
for (const table of payload.tables.slice(offset, offset + requestedLimit)) {
|
|
648
|
+
const candidate = [...tables, table];
|
|
649
|
+
if (tables.length > 0 && Buffer.byteLength(JSON.stringify(candidate)) > 7_000) break;
|
|
650
|
+
tables.push(table);
|
|
651
|
+
}
|
|
652
|
+
const nextOffset = offset + tables.length < totalCount ? offset + tables.length : null;
|
|
653
|
+
return {
|
|
654
|
+
...retained,
|
|
655
|
+
schema: payload.schema,
|
|
656
|
+
receipt: {
|
|
657
|
+
schema: 'tiwater.docx-table-index-receipt/v1',
|
|
658
|
+
totalCount,
|
|
659
|
+
returnedCount: tables.length,
|
|
660
|
+
remaining: totalCount - offset - tables.length,
|
|
661
|
+
nextOffset,
|
|
662
|
+
},
|
|
663
|
+
tables,
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
if (tool === 'docx_read_table') return { ...retained, ...payload };
|
|
616
667
|
throw new Error(`unsupported-docx-observation-tool:${tool}`);
|
|
617
668
|
});
|
|
618
669
|
}
|