@tiwater/office-mcp 0.18.4 → 0.18.6

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
+ }
@@ -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.4"
5
+ "version": "0.18.6"
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": {
package/office/index.mjs CHANGED
@@ -228,6 +228,31 @@ const docxTableIndexOutput = artifactOutput('docx_table_index').extend({
228
228
  }).strict()),
229
229
  }).strict();
230
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
+
231
256
  const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
232
257
  observations: z.array(docxObservationNode).min(1),
233
258
  }).strict();
@@ -243,7 +268,7 @@ const tools = [
243
268
  },
244
269
  {
245
270
  name: 'docx_list_objects',
246
- description: 'List one small page of nearest-child OpenXML addresses from the current DOCX in native document order and retain the exact page at output. Continue with nextOffset and descend through a returned address as parent. Text previews describe already located objects; they do not prove descendant content.',
271
+ description: 'Page through mixed nearest-child OpenXML objects when document order or paragraph relationships are required. Continue with nextOffset and descend through a returned parent address. Do not use this tool to locate tables or read a whole document: use docx_table_index to locate tables, then docx_read_table for one selected table.',
247
272
  inputSchema: inputContract('docx_list_objects'),
248
273
  outputSchema: docxListObjectsOutput,
249
274
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -251,7 +276,7 @@ const tools = [
251
276
  },
252
277
  {
253
278
  name: 'docx_table_index',
254
- 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.',
279
+ description: 'Locate tables in one current DOCX. Returns one compact index containing every table address, shape, and short text preview. Choose the needed address from this index, then call docx_read_table. It does not return full cell content or decide table semantics.',
255
280
  inputSchema: inputContract('docx_table_index'),
256
281
  outputSchema: docxTableIndexOutput,
257
282
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -259,12 +284,20 @@ const tools = [
259
284
  },
260
285
  {
261
286
  name: 'docx_read_object',
262
- 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.',
263
288
  inputSchema: inputContract('docx_read_object'),
264
289
  outputSchema: docxReadObjectOutput,
265
290
  annotations: { readOnlyHint: true, idempotentHint: true },
266
291
  handler: docxReadObject,
267
292
  },
293
+ {
294
+ name: 'docx_read_table',
295
+ description: 'Read exactly one table selected from docx_table_index by native OpenXML address. Returns its rows, cells, spans, vertical merges, paragraphs, text nodes, and reusable addresses in document order. It does not locate 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
+ },
268
301
  {
269
302
  name: 'docx_copy_content',
270
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.',
@@ -579,7 +612,7 @@ async function docxObservation(tool, args) {
579
612
  if (tool === 'docx_list_objects') {
580
613
  return { ...retained, ...payload, objects: payload.objects.map(compactDocxObjectIdentity) };
581
614
  }
582
- if (tool === 'docx_table_index') return { ...retained, ...payload };
615
+ if (tool === 'docx_table_index' || tool === 'docx_read_table') return { ...retained, ...payload };
583
616
  throw new Error(`unsupported-docx-observation-tool:${tool}`);
584
617
  });
585
618
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.18.4",
3
+ "version": "0.18.6",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",