@tiwater/office-mcp 0.15.2 → 0.15.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.
@@ -8,8 +8,9 @@ import { spawn } from 'node:child_process';
8
8
  const sharedDir = path.dirname(fileURLToPath(import.meta.url));
9
9
  export const repoRoot = path.resolve(sharedDir, '..', '..');
10
10
 
11
- export function createToolResult(payload) {
11
+ export function createToolResult(payload, { isError = false } = {}) {
12
12
  return {
13
+ ...(isError ? { isError: true } : {}),
13
14
  structuredContent: payload,
14
15
  content: [
15
16
  {
package/office/README.md CHANGED
@@ -6,6 +6,9 @@ The server owns technical observation, native conversion, fixed-action edits,
6
6
  package validation, and native WPS rendering. Callers own document selections,
7
7
  values, business mappings, workflow decisions, and delivery status.
8
8
 
9
+ Every inspect/export result binds its observation artifact to the exact source
10
+ file path, SHA-256, and byte count used by that invocation.
11
+
9
12
  Every filesystem argument is identified in the published MCP input schema by
10
13
  `x-tiwater-file-role`. `read` marks an existing provider input; `write` marks a
11
14
  new provider artifact. Strings without this metadata are document values or
@@ -27,6 +30,9 @@ Each mutation tool fixes its provider operation type. Callers submit only the
27
30
  coordinates and values for that action, so they cannot provide an arbitrary
28
31
  operation discriminator or a multi-action plan language. A call may batch
29
32
  multiple changes only when every change has the same action kind.
33
+ When a completed mutation receipt reports `summary.pass=false`, the MCP result
34
+ also sets the standard `isError` field; consumers do not need a private failure
35
+ interpretation.
30
36
 
31
37
  Structural worksheet row deletion is exposed as `xlsx_delete_rows`. Each change
32
38
  contains only `sheet`, `startRow`, and `count`; unsupported dependent workbook
@@ -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.15.2"
5
+ "version": "0.15.4"
6
6
  },
7
7
  "tools": [
8
8
  {
package/office/index.mjs CHANGED
@@ -185,7 +185,7 @@ function fixedEditOutput(tool) {
185
185
  }
186
186
 
187
187
  function artifactOutput(tool) {
188
- return z.object({ tool: z.literal(tool), runtime: runtimeIdentity, artifact }).strict();
188
+ return z.object({ tool: z.literal(tool), runtime: runtimeIdentity, source: artifact, artifact }).strict();
189
189
  }
190
190
 
191
191
  const tools = [
@@ -382,25 +382,30 @@ function buildServer() {
382
382
  ...(tool.outputSchema ? { outputSchema: tool.outputSchema } : {}),
383
383
  ...(tool.annotations ? { annotations: tool.annotations } : {}),
384
384
  },
385
- async args => createToolResult(await tool.handler(args)),
385
+ async args => {
386
+ const payload = await tool.handler(args);
387
+ return createToolResult(payload, { isError: payload?.summary?.pass === false });
388
+ },
386
389
  );
387
390
  }
388
391
  return server;
389
392
  }
390
393
 
391
394
  async function docxInspect(args) {
392
- const input = requireString(args.input, 'input');
395
+ const input = path.resolve(requireString(args.input, 'input'));
393
396
  const result = await runJsonCandidateChain(docxCandidates, ['inspect', input, '--json']);
394
397
  return {
395
398
  tool: 'docx_inspect',
396
399
  runtime: commandRuntime(result),
400
+ source: await fileArtifact(input),
397
401
  artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
398
402
  };
399
403
  }
400
404
 
401
405
  async function docxInspectTables(args) {
402
- const result = await runJsonCandidateChain(docxCandidates, ['inspect-tables', requireString(args.input, 'input'), '--json']);
403
- return { tool: 'docx_inspect_tables', runtime: commandRuntime(result), artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json) };
406
+ const input = path.resolve(requireString(args.input, 'input'));
407
+ const result = await runJsonCandidateChain(docxCandidates, ['inspect-tables', input, '--json']);
408
+ return { tool: 'docx_inspect_tables', runtime: commandRuntime(result), source: await fileArtifact(input), artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json) };
404
409
  }
405
410
 
406
411
  async function docxObservation(tool, args) {
@@ -475,11 +480,12 @@ async function docxCompare(args) {
475
480
  }
476
481
 
477
482
  async function docxExportJson(args) {
478
- const input = requireString(args.input, 'input');
483
+ const input = path.resolve(requireString(args.input, 'input'));
479
484
  const result = await runJsonCandidateChain(docxCandidates, ['export-json', input]);
480
485
  return {
481
486
  tool: 'docx_export_json',
482
487
  runtime: commandRuntime(result),
488
+ source: await fileArtifact(input),
483
489
  artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
484
490
  };
485
491
  }
@@ -567,17 +573,18 @@ function nativeRenderBackend(sourceFormat) {
567
573
  }
568
574
 
569
575
  async function xlsxInspect(args) {
570
- const input = requireString(args.input, 'input');
576
+ const input = path.resolve(requireString(args.input, 'input'));
571
577
  const result = await runJsonCandidateChain(xlsxCandidates, ['inspect', input, '--json']);
572
578
  return {
573
579
  tool: 'xlsx_inspect',
574
580
  runtime: commandRuntime(result),
581
+ source: await fileArtifact(input),
575
582
  artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
576
583
  };
577
584
  }
578
585
 
579
586
  async function xlsxExportJson(args) {
580
- const input = requireString(args.input, 'input');
587
+ const input = path.resolve(requireString(args.input, 'input'));
581
588
  const cmdArgs = ['export-json', input];
582
589
  if (args.resolveMergedCells) {
583
590
  cmdArgs.push('--resolve-merged-cells');
@@ -586,6 +593,7 @@ async function xlsxExportJson(args) {
586
593
  return {
587
594
  tool: 'xlsx_export_json',
588
595
  runtime: commandRuntime(result),
596
+ source: await fileArtifact(input),
589
597
  artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
590
598
  };
591
599
  }
@@ -597,21 +605,23 @@ async function xlsxValidate(args) {
597
605
  }
598
606
 
599
607
  async function pptxInspect(args) {
600
- const input = requireString(args.input, 'input');
608
+ const input = path.resolve(requireString(args.input, 'input'));
601
609
  const result = await runJsonCandidateChain(pptxCandidates, ['inspect', input, '--json']);
602
610
  return {
603
611
  tool: 'pptx_inspect',
604
612
  runtime: commandRuntime(result),
613
+ source: await fileArtifact(input),
605
614
  artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
606
615
  };
607
616
  }
608
617
 
609
618
  async function pptxExportJson(args) {
610
- const input = requireString(args.input, 'input');
619
+ const input = path.resolve(requireString(args.input, 'input'));
611
620
  const result = await runJsonCandidateChain(pptxCandidates, ['export-json', input]);
612
621
  return {
613
622
  tool: 'pptx_export_json',
614
623
  runtime: commandRuntime(result),
624
+ source: await fileArtifact(input),
615
625
  artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
616
626
  };
617
627
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",