@tiwater/office-mcp 0.18.3 → 0.18.5

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,28 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "tiwater.office-mcp-input/docx_read_table/v1",
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
+ },
20
+ "output": {
21
+ "type": "string",
22
+ "minLength": 1,
23
+ "x-tiwater-file-role": "write"
24
+ }
25
+ },
26
+ "required": ["input", "table", "output"],
27
+ "additionalProperties": false
28
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "tiwater.office-mcp-input/docx_table_index/v1",
4
+ "type": "object",
5
+ "properties": {
6
+ "input": {
7
+ "type": "string",
8
+ "minLength": 1,
9
+ "description": "Current DOCX path.",
10
+ "x-tiwater-file-role": "read"
11
+ },
12
+ "output": {
13
+ "type": "string",
14
+ "minLength": 1,
15
+ "description": "New JSON artifact path for the complete table index.",
16
+ "x-tiwater-file-role": "write"
17
+ }
18
+ },
19
+ "required": ["input", "output"],
20
+ "additionalProperties": false
21
+ }
@@ -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.3"
5
+ "version": "0.18.5"
6
6
  },
7
7
  "tools": [
8
8
  {
@@ -126,6 +126,17 @@
126
126
  "sha256": "f8d29a89c0a321332d5d964c970b2cb18c7ecd59f87e9892e6779747a00f9825"
127
127
  }
128
128
  },
129
+ {
130
+ "name": "docx_read_table",
131
+ "providerContract": {
132
+ "source": "packages/docx-cli/contracts/mcp-input/docx_read_table.schema.json",
133
+ "sha256": "3b85fb6bc390053abdcdbcf4d5a2a4f958a06154286a0327676144324706af83"
134
+ },
135
+ "inputContract": {
136
+ "path": "office/contracts/docx_read_table.schema.json",
137
+ "sha256": "3b85fb6bc390053abdcdbcf4d5a2a4f958a06154286a0327676144324706af83"
138
+ }
139
+ },
129
140
  {
130
141
  "name": "docx_refresh_fields",
131
142
  "providerContract": {
@@ -192,6 +203,17 @@
192
203
  "sha256": "4931d4432c574154eb7a344ee4dc485d99d8840c07d2e46f647e14490cbeedae"
193
204
  }
194
205
  },
206
+ {
207
+ "name": "docx_table_index",
208
+ "providerContract": {
209
+ "source": "packages/docx-cli/contracts/mcp-input/docx_table_index.schema.json",
210
+ "sha256": "7549ce28e3cc51ae17cd86c77c97698b6e90f0125afd34ae8831fde7f87ddf67"
211
+ },
212
+ "inputContract": {
213
+ "path": "office/contracts/docx_table_index.schema.json",
214
+ "sha256": "7549ce28e3cc51ae17cd86c77c97698b6e90f0125afd34ae8831fde7f87ddf67"
215
+ }
216
+ },
195
217
  {
196
218
  "name": "docx_validate",
197
219
  "providerContract": {
package/office/index.mjs CHANGED
@@ -216,6 +216,43 @@ const docxListObjectsOutput = artifactOutput('docx_list_objects').extend({
216
216
  runtime: runtimeIdentity,
217
217
  }).strict();
218
218
 
219
+ const docxTableIndexOutput = artifactOutput('docx_table_index').extend({
220
+ schema: z.literal('tiwater.docx-table-index/v1'),
221
+ tables: z.array(z.object({
222
+ address: docxAddress,
223
+ parentAddress: docxAddress.nullable(),
224
+ rowCount: z.number().int().nonnegative(),
225
+ columnCount: z.number().int().nonnegative(),
226
+ textPreview: z.string(),
227
+ textLength: z.number().int().nonnegative(),
228
+ }).strict()),
229
+ }).strict();
230
+
231
+ const docxTableReadOutput = artifactOutput('docx_read_table').extend({
232
+ schema: z.literal('tiwater.docx-table-read/v1'),
233
+ address: docxAddress,
234
+ rowCount: z.number().int().nonnegative(),
235
+ columnCount: z.number().int().nonnegative(),
236
+ rows: z.array(z.object({
237
+ address: docxAddress,
238
+ gridBefore: z.number().int().nonnegative(),
239
+ gridAfter: z.number().int().nonnegative(),
240
+ cells: z.array(z.object({
241
+ address: docxAddress,
242
+ gridSpan: z.number().int().positive(),
243
+ verticalMerge: z.string().nullable(),
244
+ paragraphs: z.array(z.object({
245
+ address: docxAddress,
246
+ text: z.string(),
247
+ textNodes: z.array(z.object({
248
+ address: docxAddress,
249
+ text: z.string(),
250
+ }).strict()),
251
+ }).strict()),
252
+ }).strict()),
253
+ }).strict()),
254
+ }).strict();
255
+
219
256
  const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
220
257
  observations: z.array(docxObservationNode).min(1),
221
258
  }).strict();
@@ -237,14 +274,30 @@ const tools = [
237
274
  annotations: { readOnlyHint: true, idempotentHint: true },
238
275
  handler: args => docxObservation('docx_list_objects', args),
239
276
  },
277
+ {
278
+ name: 'docx_table_index',
279
+ description: 'List every table in one current DOCX as a compact native index with its OpenXML address, row count, column count, and short text preview. Use it to choose a table and confirm its shape before listing rows or reading selected content. It does not return full cell content or decide table semantics.',
280
+ inputSchema: inputContract('docx_table_index'),
281
+ outputSchema: docxTableIndexOutput,
282
+ annotations: { readOnlyHint: true, idempotentHint: true },
283
+ handler: args => docxObservation('docx_table_index', args),
284
+ },
240
285
  {
241
286
  name: 'docx_read_object',
242
- description: 'Read selected tables, rows, cells, or paragraphs from one native DOCX in one call and return them in address order. Pass the document path once and only the OpenXML addresses needed for the current target. For exact inline content, use an observed cell or paragraph address and request run or text.',
287
+ description: 'Read selected rows, cells, or paragraphs from one native DOCX in one call and return their requested descendants in address order. Use docx_read_table when the current task needs one complete table. For exact inline content, use an observed cell or paragraph address and request run or text.',
243
288
  inputSchema: inputContract('docx_read_object'),
244
289
  outputSchema: docxReadObjectOutput,
245
290
  annotations: { readOnlyHint: true, idempotentHint: true },
246
291
  handler: docxReadObject,
247
292
  },
293
+ {
294
+ name: 'docx_read_table',
295
+ description: 'Read one complete table selected by its native OpenXML address. Returns compact rows, cells, spans, vertical merges, paragraphs, text nodes, and their reusable addresses in document order. It does not search for a table or decide business meaning.',
296
+ inputSchema: inputContract('docx_read_table'),
297
+ outputSchema: docxTableReadOutput,
298
+ annotations: { readOnlyHint: true, idempotentHint: true },
299
+ handler: args => docxObservation('docx_read_table', args),
300
+ },
248
301
  {
249
302
  name: 'docx_copy_content',
250
303
  description: 'Replace content in existing plain-text target paragraphs or cells while retaining target container formatting and source inline meaning. A selection copies a whole object by OpenXML address, or an exact substring when range is attached to a run or text address.',
@@ -559,6 +612,7 @@ async function docxObservation(tool, args) {
559
612
  if (tool === 'docx_list_objects') {
560
613
  return { ...retained, ...payload, objects: payload.objects.map(compactDocxObjectIdentity) };
561
614
  }
615
+ if (tool === 'docx_table_index' || tool === 'docx_read_table') return { ...retained, ...payload };
562
616
  throw new Error(`unsupported-docx-observation-tool:${tool}`);
563
617
  });
564
618
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",