@tiwater/office-mcp 0.17.6 → 0.17.7

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.
@@ -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.17.6"
5
+ "version": "0.17.7"
6
6
  },
7
7
  "tools": [
8
8
  {
package/office/index.mjs CHANGED
@@ -187,6 +187,19 @@ const docxObjectIdentity = z.object({
187
187
  verticalMerge: z.string().nullable(),
188
188
  }).strict();
189
189
 
190
+ const docxNestedObjectIdentity = docxObjectIdentity.pick({
191
+ ref: true,
192
+ kind: true,
193
+ textPreview: true,
194
+ }).extend({
195
+ gridSpan: z.number().int().positive().optional(),
196
+ verticalMerge: z.string().optional(),
197
+ }).strict();
198
+ const docxObservationNode = z.lazy(() => z.object({
199
+ object: docxNestedObjectIdentity,
200
+ children: z.array(docxObservationNode).optional(),
201
+ }).strict());
202
+
190
203
  const docxObservationReceipt = z.object({
191
204
  schema: z.literal('tiwater.docx-observation-receipt/v1'),
192
205
  operation: z.enum(['list', 'find', 'read']),
@@ -219,8 +232,7 @@ const docxFindLiteralOutput = z.object({
219
232
 
220
233
  const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
221
234
  revision: docxRevision,
222
- object: docxObjectIdentity,
223
- objects: z.array(docxObjectIdentity).min(1),
235
+ observation: docxObservationNode,
224
236
  }).strict();
225
237
 
226
238
  const tools = [
@@ -514,15 +526,24 @@ function compactDocxObjectIdentity(object) {
514
526
  };
515
527
  }
516
528
 
517
- function compactDocxObservationObjects(observation) {
518
- const objects = [];
519
- function visit(node) {
520
- if (!node?.object) return;
521
- objects.push(compactDocxObjectIdentity(node.object));
522
- for (const child of node.children ?? []) visit(child);
529
+ function compactDocxObservation(observation) {
530
+ if (!observation?.object) throw new Error('docx-read-object-missing-observation');
531
+ function compactNode(node) {
532
+ const identity = compactDocxObjectIdentity(node.object);
533
+ const object = {
534
+ ref: identity.ref,
535
+ kind: identity.kind,
536
+ textPreview: identity.textPreview,
537
+ ...(identity.gridSpan === null ? {} : { gridSpan: identity.gridSpan }),
538
+ ...(identity.verticalMerge === null ? {} : { verticalMerge: identity.verticalMerge }),
539
+ };
540
+ const children = (node.children ?? []).map(compactNode);
541
+ return {
542
+ object,
543
+ ...(children.length === 0 ? {} : { children }),
544
+ };
523
545
  }
524
- visit(observation);
525
- return objects;
546
+ return compactNode(observation);
526
547
  }
527
548
 
528
549
  async function docxInspect(args) {
@@ -569,8 +590,7 @@ async function docxReadObject(args) {
569
590
  source: await fileArtifact(input),
570
591
  artifact: await writeJsonArtifact(output, result.json),
571
592
  revision: result.json.receipt.revision,
572
- object: compactDocxObjectIdentity(result.json.observation.object),
573
- objects: compactDocxObservationObjects(result.json.observation),
593
+ observation: compactDocxObservation(result.json.observation),
574
594
  };
575
595
  });
576
596
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.17.6",
3
+ "version": "0.17.7",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",