@tiwater/office-mcp 0.19.0 → 0.20.0

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.
@@ -27,7 +27,7 @@
27
27
  "type": "integer",
28
28
  "minimum": 0,
29
29
  "maximum": 9007199254740991,
30
- "description": "Zero-based row offset. Continue from receipt.nextOffset until it is null."
30
+ "description": "Zero-based row offset. Process each returned compact page once and continue from receipt.nextOffset; do not revisit an earlier offset."
31
31
  },
32
32
  "output": {
33
33
  "type": "string",
@@ -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.19.0"
5
+ "version": "0.20.0"
6
6
  },
7
7
  "tools": [
8
8
  {
@@ -152,11 +152,11 @@
152
152
  "name": "docx_read_table",
153
153
  "providerContract": {
154
154
  "source": "packages/docx-cli/contracts/mcp-input/docx_read_table.schema.json",
155
- "sha256": "c9c2bbab97bd58cb1426418f022f9c78be802eefb509e951fc4efa35e0096b63"
155
+ "sha256": "71e8461f5dd9522714eb832dc01d04c324f03f4deb9d2291686f4c531a68087c"
156
156
  },
157
157
  "inputContract": {
158
158
  "path": "office/contracts/docx_read_table.schema.json",
159
- "sha256": "c9c2bbab97bd58cb1426418f022f9c78be802eefb509e951fc4efa35e0096b63"
159
+ "sha256": "71e8461f5dd9522714eb832dc01d04c324f03f4deb9d2291686f4c531a68087c"
160
160
  }
161
161
  },
162
162
  {
package/office/index.mjs CHANGED
@@ -246,14 +246,14 @@ const docxTableIndexOutput = artifactOutput('docx_table_index').extend({
246
246
  }).strict();
247
247
 
248
248
  const docxTableReadOutput = artifactOutput('docx_read_table').extend({
249
- schema: z.literal('tiwater.docx-table-read/v2'),
249
+ schema: z.literal('tiwater.docx-table-page/v1'),
250
250
  receipt: z.object({
251
- schema: z.literal('tiwater.docx-table-read-receipt/v1'),
251
+ schema: z.literal('tiwater.docx-table-page-receipt/v1'),
252
252
  totalRowCount: z.number().int().nonnegative(),
253
253
  returnedRowCount: z.number().int().nonnegative(),
254
254
  remaining: z.number().int().nonnegative(),
255
255
  nextOffset: z.number().int().nonnegative().nullable(),
256
- inlineTextNodesOmitted: z.literal(true),
256
+ detailPageRetained: z.literal(true),
257
257
  narrowingRequired: z.boolean(),
258
258
  }).strict(),
259
259
  address: docxAddress,
@@ -285,14 +285,7 @@ const docxTableReadOutput = artifactOutput('docx_read_table').extend({
285
285
  gridSpan: z.number().int().positive(),
286
286
  verticalMerge: z.string().nullable(),
287
287
  verticalMergeOwner: docxAddress.nullable(),
288
- paragraphs: z.array(z.object({
289
- address: docxAddress,
290
- text: z.string(),
291
- textNodes: z.array(z.object({
292
- address: docxAddress,
293
- text: z.string(),
294
- }).strict()),
295
- }).strict()),
288
+ text: z.string(),
296
289
  }).strict()),
297
290
  }).strict()),
298
291
  }).strict();
@@ -343,7 +336,7 @@ const tools = [
343
336
  },
344
337
  {
345
338
  name: 'docx_read_table',
346
- description: 'Read exactly one table selected from docx_table_index by native OpenXML address. Writes the complete table, including text nodes, to output and returns a bounded row page with grid-column addresses and widths, each cell\'s zero-based grid start and span, vertical-merge owner, repeated-header and no-split row properties, paragraph text, and reusable addresses. In a vertical merge, restart begins one logical cell and a continue cell is not an independent row value. The provider reports physical structure only; the Agent decides the template and business meaning. Continue with receipt.nextOffset. If receipt.narrowingRequired is true, list rows under the same table and read smaller objects.',
339
+ description: 'Read exactly one table selected from docx_table_index by native OpenXML address. Each call retains full paragraph and text-node detail for exactly the returned row page at output; it never builds another whole-table data object. The machine response is the compact form of that page: each row and cell keeps its reusable native address, grid position and span, vertical-merge owner, and joined text. In a vertical merge, restart begins one logical cell and a continue cell is not an independent row value. Process the current page before continuing once with receipt.nextOffset; never revisit an earlier offset. Use docx_read_object only when one selected object needs a narrower descendant view. The provider reports physical structure only; the Agent decides the template and business meaning.',
347
340
  inputSchema: inputContract('docx_read_table'),
348
341
  outputSchema: docxTableReadOutput,
349
342
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -365,7 +358,7 @@ const tools = [
365
358
  },
366
359
  {
367
360
  name: 'docx_insert_objects',
368
- description: 'Insert selected current DOCX objects under an existing parent. Table rows are objects: expand a target table by copying one contiguous observed row range that closes every vertical merge, using before only at a target vertical-merge boundary and repeat for count; sourceInput may equal input. Individual table cells are not raw insertion targets because that would bypass the table grid.',
361
+ description: 'Insert selected current DOCX objects under an existing parent. Table rows are objects: expand a target table by copying one contiguous observed row range and use repeat for count; sourceInput may equal input. A row range beginning with vertical-merge continuations may be inserted only inside a target boundary with the same active grid spans, which extends those merges. Individual table cells are not raw insertion targets because that would bypass the table grid.',
369
362
  inputSchema: inputContract('docx_insert_objects'),
370
363
  outputSchema: fixedEditOutput('docx_insert_objects'),
371
364
  handler: args => fixedEdit('docx_insert_objects', args),
@@ -665,7 +658,9 @@ async function docxObservation(tool, args) {
665
658
  tool,
666
659
  runtime: payload.runtime,
667
660
  source: await fileArtifact(input),
668
- artifact: await writeJsonArtifact(output, result.json),
661
+ ...(tool === 'docx_read_table' ? {} : {
662
+ artifact: await writeJsonArtifact(output, result.json),
663
+ }),
669
664
  };
670
665
  if (tool === 'docx_list_objects') {
671
666
  const totalCount = payload.receipt.totalCount;
@@ -723,10 +718,18 @@ async function docxObservation(tool, args) {
723
718
  let narrowingRequired = false;
724
719
  for (const sourceRow of payload.rows.slice(offset, offset + requestedLimit)) {
725
720
  const row = {
726
- ...sourceRow,
721
+ address: sourceRow.address,
722
+ repeatHeader: sourceRow.repeatHeader,
723
+ cantSplit: sourceRow.cantSplit,
724
+ gridBefore: sourceRow.gridBefore,
725
+ gridAfter: sourceRow.gridAfter,
727
726
  cells: sourceRow.cells.map(cell => ({
728
- ...cell,
729
- paragraphs: cell.paragraphs.map(paragraph => ({ ...paragraph, textNodes: [] })),
727
+ address: cell.address,
728
+ gridColumnStart: cell.gridColumnStart,
729
+ gridSpan: cell.gridSpan,
730
+ verticalMerge: cell.verticalMerge,
731
+ verticalMergeOwner: cell.verticalMergeOwner,
732
+ text: cell.paragraphs.map(paragraph => paragraph.text).join('\n'),
730
733
  })),
731
734
  };
732
735
  const candidate = [...rows, row];
@@ -739,9 +742,28 @@ async function docxObservation(tool, args) {
739
742
  const nextOffset = !narrowingRequired && offset + rows.length < totalRowCount
740
743
  ? offset + rows.length
741
744
  : null;
745
+ const pageReceipt = {
746
+ schema: 'tiwater.docx-table-page-receipt/v1',
747
+ totalRowCount,
748
+ returnedRowCount: rows.length,
749
+ remaining: totalRowCount - offset - rows.length,
750
+ nextOffset,
751
+ };
752
+ const detailPage = {
753
+ schema: 'tiwater.docx-table-detail-page/v1',
754
+ address: payload.address,
755
+ rowCount: payload.rowCount,
756
+ columnCount: payload.columnCount,
757
+ gridColumns: payload.gridColumns,
758
+ precedingParagraph: payload.precedingParagraph,
759
+ followingParagraph: payload.followingParagraph,
760
+ receipt: pageReceipt,
761
+ rows: payload.rows.slice(offset, offset + rows.length),
762
+ };
742
763
  return {
743
764
  ...retained,
744
- schema: payload.schema,
765
+ artifact: await writeJsonArtifact(output, detailPage),
766
+ schema: 'tiwater.docx-table-page/v1',
745
767
  address: payload.address,
746
768
  rowCount: payload.rowCount,
747
769
  columnCount: payload.columnCount,
@@ -749,12 +771,8 @@ async function docxObservation(tool, args) {
749
771
  precedingParagraph: payload.precedingParagraph,
750
772
  followingParagraph: payload.followingParagraph,
751
773
  receipt: {
752
- schema: 'tiwater.docx-table-read-receipt/v1',
753
- totalRowCount,
754
- returnedRowCount: rows.length,
755
- remaining: totalRowCount - offset - rows.length,
756
- nextOffset,
757
- inlineTextNodesOmitted: true,
774
+ ...pageReceipt,
775
+ detailPageRetained: true,
758
776
  narrowingRequired,
759
777
  },
760
778
  rows,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",