@tiwater/office-mcp 0.21.2 → 0.21.4

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.
@@ -0,0 +1,129 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "tiwater.office-mcp-input/docx_set_table_body",
4
+ "type": "object",
5
+ "properties": {
6
+ "input": {
7
+ "type": "string",
8
+ "minLength": 1,
9
+ "x-tiwater-file-role": "read"
10
+ },
11
+ "table": {
12
+ "type": "object",
13
+ "properties": {
14
+ "part": { "type": "string", "minLength": 1 },
15
+ "path": { "type": "string", "pattern": "^\\/" }
16
+ },
17
+ "required": ["part", "path"],
18
+ "additionalProperties": false,
19
+ "description": "Current target table address returned by docx_read_table or docx_table_index."
20
+ },
21
+ "existingRows": {
22
+ "type": "object",
23
+ "description": "Exact contiguous current row range to replace. Rows outside this range stay unchanged, and the range must enclose every vertical merge it intersects.",
24
+ "properties": {
25
+ "first": {
26
+ "type": "object",
27
+ "properties": {
28
+ "part": { "type": "string", "minLength": 1 },
29
+ "path": { "type": "string", "pattern": "^\\/" }
30
+ },
31
+ "required": ["part", "path"],
32
+ "additionalProperties": false
33
+ },
34
+ "last": {
35
+ "type": "object",
36
+ "properties": {
37
+ "part": { "type": "string", "minLength": 1 },
38
+ "path": { "type": "string", "pattern": "^\\/" }
39
+ },
40
+ "required": ["part", "path"],
41
+ "additionalProperties": false
42
+ }
43
+ },
44
+ "required": ["first", "last"],
45
+ "additionalProperties": false
46
+ },
47
+ "columns": {
48
+ "type": "array",
49
+ "minItems": 1,
50
+ "description": "Complete target table grid in the native order returned by docx_read_table. IDs are request-local names used only by rows below.",
51
+ "items": {
52
+ "type": "object",
53
+ "properties": {
54
+ "id": { "type": "string", "minLength": 1, "maxLength": 80 },
55
+ "gridColumn": {
56
+ "type": "object",
57
+ "properties": {
58
+ "part": { "type": "string", "minLength": 1 },
59
+ "path": { "type": "string", "pattern": "^\\/" }
60
+ },
61
+ "required": ["part", "path"],
62
+ "additionalProperties": false
63
+ }
64
+ },
65
+ "required": ["id", "gridColumn"],
66
+ "additionalProperties": false
67
+ }
68
+ },
69
+ "rows": {
70
+ "type": "array",
71
+ "minItems": 0,
72
+ "description": "Exact final rows; an empty array removes the declared range when at least one table row remains. Each final row names one current row in existingRows as its style prototype. Cells plus active row spans must cover the complete target grid exactly once.",
73
+ "items": {
74
+ "type": "object",
75
+ "properties": {
76
+ "prototypeRow": {
77
+ "type": "object",
78
+ "properties": {
79
+ "part": { "type": "string", "minLength": 1 },
80
+ "path": { "type": "string", "pattern": "^\\/" }
81
+ },
82
+ "required": ["part", "path"],
83
+ "additionalProperties": false
84
+ },
85
+ "cells": {
86
+ "type": "array",
87
+ "minItems": 1,
88
+ "items": {
89
+ "type": "object",
90
+ "properties": {
91
+ "columns": {
92
+ "type": "array",
93
+ "minItems": 1,
94
+ "description": "One or more contiguous request-local column IDs occupied by this cell.",
95
+ "items": { "type": "string", "minLength": 1, "maxLength": 80 }
96
+ },
97
+ "text": { "type": "string" },
98
+ "rowSpan": {
99
+ "type": "integer",
100
+ "minimum": 1,
101
+ "maximum": 2147483647,
102
+ "description": "Number of final rows occupied by this cell; omitted means one row."
103
+ }
104
+ },
105
+ "required": ["columns", "text"],
106
+ "additionalProperties": false
107
+ }
108
+ }
109
+ },
110
+ "required": ["prototypeRow", "cells"],
111
+ "additionalProperties": false
112
+ }
113
+ },
114
+ "output": {
115
+ "type": "string",
116
+ "minLength": 1,
117
+ "description": "Output DOCX path; may equal input for one atomic in-place update.",
118
+ "x-tiwater-file-role": "write"
119
+ },
120
+ "receiptOutput": {
121
+ "type": "string",
122
+ "minLength": 1,
123
+ "x-tiwater-file-role": "write",
124
+ "x-tiwater-file-effect": false
125
+ }
126
+ },
127
+ "required": ["input", "table", "existingRows", "columns", "rows", "output", "receiptOutput"],
128
+ "additionalProperties": false
129
+ }
@@ -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.21.2"
5
+ "version": "0.21.4"
6
6
  },
7
7
  "tools": [
8
8
  {
@@ -181,6 +181,17 @@
181
181
  "sha256": "25f4d4e7c69fa5a2c4a82621aa58ea8eda21245636f84f2243ca4e9092616b68"
182
182
  }
183
183
  },
184
+ {
185
+ "name": "docx_set_table_body",
186
+ "providerContract": {
187
+ "source": "packages/docx-cli/contracts/mcp-input/docx_set_table_body.schema.json",
188
+ "sha256": "2270274f25154dc0573c972c8c71240636e29e7e23a1eacae616952cc600b1e0"
189
+ },
190
+ "inputContract": {
191
+ "path": "office/contracts/docx_set_table_body.schema.json",
192
+ "sha256": "2270274f25154dc0573c972c8c71240636e29e7e23a1eacae616952cc600b1e0"
193
+ }
194
+ },
184
195
  {
185
196
  "name": "docx_set_text",
186
197
  "providerContract": {
package/office/index.mjs CHANGED
@@ -316,7 +316,7 @@ const docxTableReadOutput = docxObservationOutput('docx_read_table').extend({
316
316
  totalRowCount: z.number().int().nonnegative(),
317
317
  returnedRowCount: z.number().int().nonnegative(),
318
318
  remaining: z.number().int().nonnegative(),
319
- nextOffset: z.number().int().nonnegative().nullable(),
319
+ nextOffset: z.number().int().nonnegative().optional(),
320
320
  detailPageRetained: z.boolean(),
321
321
  narrowingRequired: z.boolean(),
322
322
  }).strict(),
@@ -401,7 +401,7 @@ const tools = [
401
401
  },
402
402
  {
403
403
  name: 'docx_read_table',
404
- description: 'Read an explicit row range from exactly one table selected by native OpenXML address; it never builds another whole-table data object. Set returnContent true to return a byte-bounded compact row page. Provide output to store full paragraph and text-node detail for the selected row page and return its artifact receipt. These channels are independent and may be used together; at least one is required. Request only rows needed for the current decision; receipt.remaining is navigation information, not an obligation to read unused rows, and blank template rows need not be paged through. Each returned row and cell keeps its reusable native address, zero-based logical gridColumnStart, gridSpan, vertical-merge owner, physical text, and logical text. Match columns across rows by gridColumnStart; a tc[n] path or array position is only that row\'s physical cell ordinal and is not a column identity when gridSpan or gridBefore is present. 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. Use docx_read_object when one exact object needs a narrower descendant view. The provider reports physical structure only; the Agent decides template and business meaning.',
404
+ description: 'Read an explicit row range from exactly one table selected by native OpenXML address; it never builds another whole-table data object. Set returnContent true to return a byte-bounded compact row page. Provide output to store full paragraph and text-node detail for the selected row page and return its artifact receipt. These channels are independent and may be used together; at least one is required. Request only rows needed for the current decision; receipt.remaining is navigation information, not an obligation to read unused rows, and blank template rows need not be paged through. receipt.nextOffset is present only when another row page exists. Each returned row and cell keeps its reusable native address, zero-based logical gridColumnStart, gridSpan, vertical-merge owner, physical text, and logical text. Match columns across rows by gridColumnStart; a tc[n] path or array position is only that row\'s physical cell ordinal and is not a column identity when gridSpan or gridBefore is present. 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. Use docx_read_object when one exact object needs a narrower descendant view. The provider reports physical structure only; the Agent decides template and business meaning.',
405
405
  inputSchema: inputContract('docx_read_table'),
406
406
  outputSchema: docxTableReadOutput,
407
407
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -421,6 +421,13 @@ const tools = [
421
421
  outputSchema: fixedEditOutput('docx_set_text'),
422
422
  handler: args => fixedEdit('docx_set_text', args),
423
423
  },
424
+ {
425
+ name: 'docx_set_table_body',
426
+ description: 'Atomically replace one exact current target-table row range with final text rows while retaining the table, target styles, grid widths, and all rows and surrounding content outside the range. Name every target grid column in native order, choose one current row as the style prototype for each final row, and express horizontal spans with contiguous column IDs and vertical spans with rowSpan. An empty final row array removes the range when another table row remains. The provider commits once and returns structural readback. It does not read a source table, map source to target, derive text, choose business columns, identify headers, or accept non-text cell content.',
427
+ inputSchema: inputContract('docx_set_table_body'),
428
+ outputSchema: fixedEditOutput('docx_set_table_body'),
429
+ handler: args => fixedEdit('docx_set_table_body', args),
430
+ },
424
431
  {
425
432
  name: 'docx_insert_objects',
426
433
  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.',
@@ -850,7 +857,7 @@ async function docxObservation(tool, args) {
850
857
  totalRowCount,
851
858
  returnedRowCount: selectedRows.length,
852
859
  remaining: totalRowCount - offset - selectedRows.length,
853
- nextOffset: selectedNextOffset,
860
+ ...(selectedNextOffset === null ? {} : { nextOffset: selectedNextOffset }),
854
861
  };
855
862
  const detailPage = {
856
863
  schema: 'tiwater.docx-table-detail-page/v1',
@@ -918,7 +925,7 @@ async function docxObservation(tool, args) {
918
925
  totalRowCount,
919
926
  returnedRowCount: rows.length,
920
927
  remaining: totalRowCount - offset - rows.length,
921
- nextOffset,
928
+ ...(nextOffset === null ? {} : { nextOffset }),
922
929
  };
923
930
  return {
924
931
  ...withArtifact,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.21.2",
3
+ "version": "0.21.4",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",