@tiwater/office-mcp 0.16.12 → 0.16.14

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.
@@ -41,7 +41,7 @@
41
41
  "sourceTableRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
42
42
  "sourceRows": {
43
43
  "type": "object",
44
- "description": "Contiguous source business-row range. Do not begin on an unlabeled continuation row from an excluded business group. If another column's visible merge began before the range, the provider carries its origin value into a new merge start.",
44
+ "description": "Contiguous source business-row range. excludeRefs contains every physical row to remove; excluding a vertically merged group requires its restart row and all continuation rows. Do not begin on an unlabeled continuation row. If another column's visible merge began before the range, the provider carries its origin value into a new merge start.",
45
45
  "properties": {
46
46
  "firstRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
47
47
  "lastRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
@@ -17,16 +17,35 @@
17
17
  "type": "string",
18
18
  "pattern": "^docx-rev-v1-[0-9a-f]{64}$"
19
19
  },
20
+ "kinds": {
21
+ "description": "Object kinds required by the next operation. Both the response and artifact contain only matching descendant identities.",
22
+ "type": "array",
23
+ "items": {
24
+ "type": "string",
25
+ "enum": [
26
+ "paragraph",
27
+ "table",
28
+ "gridColumn",
29
+ "row",
30
+ "cell",
31
+ "run",
32
+ "text",
33
+ "drawing"
34
+ ]
35
+ },
36
+ "minItems": 1
37
+ },
20
38
  "output": {
21
39
  "type": "string",
22
40
  "minLength": 1,
23
- "description": "Absolute path for a new JSON artifact containing the complete native object observation.",
41
+ "description": "Absolute path for a new JSON artifact containing the selected native object and only the requested descendant kinds.",
24
42
  "x-tiwater-file-role": "write"
25
43
  }
26
44
  },
27
45
  "required": [
28
46
  "input",
29
47
  "ref",
48
+ "kinds",
30
49
  "output"
31
50
  ],
32
51
  "additionalProperties": false,
@@ -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.16.12"
5
+ "version": "0.16.14"
6
6
  },
7
7
  "tools": [
8
8
  {
@@ -42,11 +42,11 @@
42
42
  "name": "docx_copy_table_rows",
43
43
  "providerContract": {
44
44
  "source": "packages/docx-cli/contracts/mcp-input/docx_copy_table_rows.schema.json",
45
- "sha256": "f24924a80de9d9cfe619c9b4f6475d370c75fe221dcbe3af9692ad15c648d3b0"
45
+ "sha256": "2b6ba0a54290ab8671f1f5547850bb37370655f05170f6dcaffa9586e9f409f2"
46
46
  },
47
47
  "inputContract": {
48
48
  "path": "office/contracts/docx_copy_table_rows.schema.json",
49
- "sha256": "f24924a80de9d9cfe619c9b4f6475d370c75fe221dcbe3af9692ad15c648d3b0"
49
+ "sha256": "2b6ba0a54290ab8671f1f5547850bb37370655f05170f6dcaffa9586e9f409f2"
50
50
  }
51
51
  },
52
52
  {
@@ -119,11 +119,11 @@
119
119
  "name": "docx_read_object",
120
120
  "providerContract": {
121
121
  "source": "packages/docx-cli/contracts/mcp-input/docx_read_object.schema.json",
122
- "sha256": "ed4068627fe84872fb8d15d57d5950a22d03e79b4bb11cbc376a8d8b84cee0c0"
122
+ "sha256": "9b78138005fc6f875cf9ed530b8389ec4b2a751294c9d316e8b9fc2463560a3f"
123
123
  },
124
124
  "inputContract": {
125
125
  "path": "office/contracts/docx_read_object.schema.json",
126
- "sha256": "ed4068627fe84872fb8d15d57d5950a22d03e79b4bb11cbc376a8d8b84cee0c0"
126
+ "sha256": "9b78138005fc6f875cf9ed530b8389ec4b2a751294c9d316e8b9fc2463560a3f"
127
127
  }
128
128
  },
129
129
  {
package/office/index.mjs CHANGED
@@ -145,10 +145,9 @@ const docxRevision = z.object({
145
145
 
146
146
  const docxTableIndexEntry = z.object({
147
147
  ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
148
- tableIndex: z.number().int().nonnegative(),
149
- containmentPath: z.array(z.string()),
150
- parentCellAddress: z.string().nullable(),
151
- storyKind: z.string(),
148
+ parentRef: z.string().regex(/^dox1_[0-9a-f]{64}$/).nullable(),
149
+ storyPart: z.string(),
150
+ nativePath: z.string(),
152
151
  rowCount: z.number().int().nonnegative(),
153
152
  columnCount: z.number().int().nonnegative(),
154
153
  textPreview: z.string(),
@@ -167,6 +166,8 @@ const docxObjectIdentity = z.object({
167
166
  parentRef: z.string().regex(/^dox1_[0-9a-f]{64}$/).nullable(),
168
167
  kind: z.string(),
169
168
  textPreview: z.string().nullable(),
169
+ gridSpan: z.number().int().positive().nullable(),
170
+ verticalMerge: z.string().nullable(),
170
171
  }).strict();
171
172
 
172
173
  const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
@@ -199,7 +200,7 @@ const tools = [
199
200
  },
200
201
  {
201
202
  name: 'docx_read_object',
202
- description: 'Read one selected native DOCX object. The response returns that object and every descendant identity for the next operation; full Open XML remains in the evidence artifact.',
203
+ description: 'Read one selected native DOCX object. Declare only the descendant kinds required by the next operation; the response returns those identities and the evidence artifact retains the complete object.',
203
204
  inputSchema: inputContract('docx_read_object'),
204
205
  outputSchema: docxReadObjectOutput,
205
206
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -406,29 +407,10 @@ function buildServer() {
406
407
  }
407
408
 
408
409
  function compactDocxTableIndex(report) {
409
- if (!report?.Revision || !Array.isArray(report.Tables)
410
- || (report.StoryTables !== null && !Array.isArray(report.StoryTables))) {
410
+ if (!report?.revision || !Array.isArray(report.tables)) {
411
411
  throw new Error('docx-table-inspection-result-invalid');
412
412
  }
413
- const tables = [...report.Tables, ...(report.StoryTables ?? [])].map(table => {
414
- const text = table.Rows.flatMap(row => row.Cells.map(cell => cell.Text))
415
- .filter(value => typeof value === 'string' && value.length > 0)
416
- .join(' ')
417
- .replace(/\s+/gu, ' ')
418
- .trim();
419
- return {
420
- ref: table.Ref,
421
- tableIndex: table.TableIndex,
422
- containmentPath: table.ContainmentPath,
423
- parentCellAddress: table.ParentCellAddress ?? null,
424
- storyKind: table.Story.Kind,
425
- rowCount: table.RowCount,
426
- columnCount: table.ColumnCount,
427
- textPreview: text.length <= 160 ? text : `${text.slice(0, 160)}...`,
428
- textLength: text.length,
429
- };
430
- });
431
- return { revision: report.Revision, tables };
413
+ return { revision: report.revision, tables: report.tables };
432
414
  }
433
415
 
434
416
  function compactDocxObjectIdentity(object) {
@@ -437,6 +419,8 @@ function compactDocxObjectIdentity(object) {
437
419
  parentRef: object.parentRef,
438
420
  kind: object.kind,
439
421
  textPreview: object.textPreview,
422
+ gridSpan: object.gridSpan,
423
+ verticalMerge: object.verticalMerge,
440
424
  };
441
425
  }
442
426
 
@@ -472,7 +456,8 @@ async function docxReadObject(args) {
472
456
  artifact: await writeJsonArtifact(output, result.json),
473
457
  revision: result.json.receipt.revision,
474
458
  object: compactDocxObjectIdentity(result.json.observation.object),
475
- descendants: result.json.observation.descendants.map(compactDocxObjectIdentity),
459
+ descendants: result.json.observation.descendants
460
+ .map(compactDocxObjectIdentity),
476
461
  };
477
462
  });
478
463
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.16.12",
3
+ "version": "0.16.14",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",