@tiwater/office-mcp 0.18.9 → 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.9"
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": "7549ce28e3cc51ae17cd86c77c97698b6e90f0125afd34ae8831fde7f87ddf67"
210
+ "sha256": "e10ea5780559f269b6fa193aadb0fc0793009e5e7a4047a7a46aa5621dfeaac1"
211
211
  },
212
212
  "inputContract": {
213
213
  "path": "office/contracts/docx_table_index.schema.json",
214
- "sha256": "7549ce28e3cc51ae17cd86c77c97698b6e90f0125afd34ae8831fde7f87ddf67"
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(),
@@ -296,7 +303,7 @@ const tools = [
296
303
  },
297
304
  {
298
305
  name: 'docx_table_index',
299
- description: 'Locate tables in one current DOCX. Returns one compact index containing every table address, shape, short text preview, and the nearest non-empty paragraph before and after each table. Choose the needed address from this index, then call docx_read_table. It does not return full cell content or decide table semantics.',
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.',
300
307
  inputSchema: inputContract('docx_table_index'),
301
308
  outputSchema: docxTableIndexOutput,
302
309
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -632,7 +639,31 @@ async function docxObservation(tool, args) {
632
639
  if (tool === 'docx_list_objects') {
633
640
  return { ...retained, ...payload, objects: payload.objects.map(compactDocxObjectIdentity) };
634
641
  }
635
- if (tool === 'docx_table_index' || tool === 'docx_read_table') return { ...retained, ...payload };
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 };
636
667
  throw new Error(`unsupported-docx-observation-tool:${tool}`);
637
668
  });
638
669
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.18.9",
3
+ "version": "0.18.10",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",