@tiwater/office-mcp 0.19.1 → 0.20.1

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.1"
5
+ "version": "0.20.1"
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,8 @@ 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(),
289
+ logicalText: z.string(),
296
290
  }).strict()),
297
291
  }).strict()),
298
292
  }).strict();
@@ -343,7 +337,7 @@ const tools = [
343
337
  },
344
338
  {
345
339
  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.',
340
+ 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, physical text, and logical text. In a vertical merge, restart begins one logical cell and a continue cell is not an independent row value: logicalText resolves the restart cell value while text remains the physical cell 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
341
  inputSchema: inputContract('docx_read_table'),
348
342
  outputSchema: docxTableReadOutput,
349
343
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -665,7 +659,9 @@ async function docxObservation(tool, args) {
665
659
  tool,
666
660
  runtime: payload.runtime,
667
661
  source: await fileArtifact(input),
668
- artifact: await writeJsonArtifact(output, result.json),
662
+ ...(tool === 'docx_read_table' ? {} : {
663
+ artifact: await writeJsonArtifact(output, result.json),
664
+ }),
669
665
  };
670
666
  if (tool === 'docx_list_objects') {
671
667
  const totalCount = payload.receipt.totalCount;
@@ -723,10 +719,19 @@ async function docxObservation(tool, args) {
723
719
  let narrowingRequired = false;
724
720
  for (const sourceRow of payload.rows.slice(offset, offset + requestedLimit)) {
725
721
  const row = {
726
- ...sourceRow,
722
+ address: sourceRow.address,
723
+ repeatHeader: sourceRow.repeatHeader,
724
+ cantSplit: sourceRow.cantSplit,
725
+ gridBefore: sourceRow.gridBefore,
726
+ gridAfter: sourceRow.gridAfter,
727
727
  cells: sourceRow.cells.map(cell => ({
728
- ...cell,
729
- paragraphs: cell.paragraphs.map(paragraph => ({ ...paragraph, textNodes: [] })),
728
+ address: cell.address,
729
+ gridColumnStart: cell.gridColumnStart,
730
+ gridSpan: cell.gridSpan,
731
+ verticalMerge: cell.verticalMerge,
732
+ verticalMergeOwner: cell.verticalMergeOwner,
733
+ text: cell.paragraphs.map(paragraph => paragraph.text).join('\n'),
734
+ logicalText: cell.logicalText,
730
735
  })),
731
736
  };
732
737
  const candidate = [...rows, row];
@@ -739,9 +744,28 @@ async function docxObservation(tool, args) {
739
744
  const nextOffset = !narrowingRequired && offset + rows.length < totalRowCount
740
745
  ? offset + rows.length
741
746
  : null;
747
+ const pageReceipt = {
748
+ schema: 'tiwater.docx-table-page-receipt/v1',
749
+ totalRowCount,
750
+ returnedRowCount: rows.length,
751
+ remaining: totalRowCount - offset - rows.length,
752
+ nextOffset,
753
+ };
754
+ const detailPage = {
755
+ schema: 'tiwater.docx-table-detail-page/v1',
756
+ address: payload.address,
757
+ rowCount: payload.rowCount,
758
+ columnCount: payload.columnCount,
759
+ gridColumns: payload.gridColumns,
760
+ precedingParagraph: payload.precedingParagraph,
761
+ followingParagraph: payload.followingParagraph,
762
+ receipt: pageReceipt,
763
+ rows: payload.rows.slice(offset, offset + rows.length),
764
+ };
742
765
  return {
743
766
  ...retained,
744
- schema: payload.schema,
767
+ artifact: await writeJsonArtifact(output, detailPage),
768
+ schema: 'tiwater.docx-table-page/v1',
745
769
  address: payload.address,
746
770
  rowCount: payload.rowCount,
747
771
  columnCount: payload.columnCount,
@@ -749,12 +773,8 @@ async function docxObservation(tool, args) {
749
773
  precedingParagraph: payload.precedingParagraph,
750
774
  followingParagraph: payload.followingParagraph,
751
775
  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,
776
+ ...pageReceipt,
777
+ detailPageRetained: true,
758
778
  narrowingRequired,
759
779
  },
760
780
  rows,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.19.1",
3
+ "version": "0.20.1",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",