@tiwater/office-mcp 0.15.3 → 0.15.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.
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
|
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 = [
|
|
@@ -392,18 +392,20 @@ function buildServer() {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
async function docxInspect(args) {
|
|
395
|
-
const input = requireString(args.input, 'input');
|
|
395
|
+
const input = path.resolve(requireString(args.input, 'input'));
|
|
396
396
|
const result = await runJsonCandidateChain(docxCandidates, ['inspect', input, '--json']);
|
|
397
397
|
return {
|
|
398
398
|
tool: 'docx_inspect',
|
|
399
399
|
runtime: commandRuntime(result),
|
|
400
|
+
source: await fileArtifact(input),
|
|
400
401
|
artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
|
|
401
402
|
};
|
|
402
403
|
}
|
|
403
404
|
|
|
404
405
|
async function docxInspectTables(args) {
|
|
405
|
-
const
|
|
406
|
-
|
|
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) };
|
|
407
409
|
}
|
|
408
410
|
|
|
409
411
|
async function docxObservation(tool, args) {
|
|
@@ -458,6 +460,10 @@ async function fixedEdit(tool, args) {
|
|
|
458
460
|
: pptxCandidates;
|
|
459
461
|
return withTempJsonFile(args, async requestPath => {
|
|
460
462
|
const result = await runJsonCandidateChain(candidates, [tool, requestPath], { allowedExitCodes: [0, 1] });
|
|
463
|
+
if (result.code !== 0) {
|
|
464
|
+
const detail = result.stderr.trim() || result.stdout.trim() || `${tool} failed with exit code ${result.code}`;
|
|
465
|
+
throw new Error(detail);
|
|
466
|
+
}
|
|
461
467
|
if (result.json?.tool !== tool) throw new Error(`${tool} returned a mismatched tool identity`);
|
|
462
468
|
await requireReturnedArtifact(result.json.receipt, receiptOutput, 'receipt');
|
|
463
469
|
if (result.json.output === null) {
|
|
@@ -478,11 +484,12 @@ async function docxCompare(args) {
|
|
|
478
484
|
}
|
|
479
485
|
|
|
480
486
|
async function docxExportJson(args) {
|
|
481
|
-
const input = requireString(args.input, 'input');
|
|
487
|
+
const input = path.resolve(requireString(args.input, 'input'));
|
|
482
488
|
const result = await runJsonCandidateChain(docxCandidates, ['export-json', input]);
|
|
483
489
|
return {
|
|
484
490
|
tool: 'docx_export_json',
|
|
485
491
|
runtime: commandRuntime(result),
|
|
492
|
+
source: await fileArtifact(input),
|
|
486
493
|
artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
|
|
487
494
|
};
|
|
488
495
|
}
|
|
@@ -570,17 +577,18 @@ function nativeRenderBackend(sourceFormat) {
|
|
|
570
577
|
}
|
|
571
578
|
|
|
572
579
|
async function xlsxInspect(args) {
|
|
573
|
-
const input = requireString(args.input, 'input');
|
|
580
|
+
const input = path.resolve(requireString(args.input, 'input'));
|
|
574
581
|
const result = await runJsonCandidateChain(xlsxCandidates, ['inspect', input, '--json']);
|
|
575
582
|
return {
|
|
576
583
|
tool: 'xlsx_inspect',
|
|
577
584
|
runtime: commandRuntime(result),
|
|
585
|
+
source: await fileArtifact(input),
|
|
578
586
|
artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
|
|
579
587
|
};
|
|
580
588
|
}
|
|
581
589
|
|
|
582
590
|
async function xlsxExportJson(args) {
|
|
583
|
-
const input = requireString(args.input, 'input');
|
|
591
|
+
const input = path.resolve(requireString(args.input, 'input'));
|
|
584
592
|
const cmdArgs = ['export-json', input];
|
|
585
593
|
if (args.resolveMergedCells) {
|
|
586
594
|
cmdArgs.push('--resolve-merged-cells');
|
|
@@ -589,6 +597,7 @@ async function xlsxExportJson(args) {
|
|
|
589
597
|
return {
|
|
590
598
|
tool: 'xlsx_export_json',
|
|
591
599
|
runtime: commandRuntime(result),
|
|
600
|
+
source: await fileArtifact(input),
|
|
592
601
|
artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
|
|
593
602
|
};
|
|
594
603
|
}
|
|
@@ -600,21 +609,23 @@ async function xlsxValidate(args) {
|
|
|
600
609
|
}
|
|
601
610
|
|
|
602
611
|
async function pptxInspect(args) {
|
|
603
|
-
const input = requireString(args.input, 'input');
|
|
612
|
+
const input = path.resolve(requireString(args.input, 'input'));
|
|
604
613
|
const result = await runJsonCandidateChain(pptxCandidates, ['inspect', input, '--json']);
|
|
605
614
|
return {
|
|
606
615
|
tool: 'pptx_inspect',
|
|
607
616
|
runtime: commandRuntime(result),
|
|
617
|
+
source: await fileArtifact(input),
|
|
608
618
|
artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
|
|
609
619
|
};
|
|
610
620
|
}
|
|
611
621
|
|
|
612
622
|
async function pptxExportJson(args) {
|
|
613
|
-
const input = requireString(args.input, 'input');
|
|
623
|
+
const input = path.resolve(requireString(args.input, 'input'));
|
|
614
624
|
const result = await runJsonCandidateChain(pptxCandidates, ['export-json', input]);
|
|
615
625
|
return {
|
|
616
626
|
tool: 'pptx_export_json',
|
|
617
627
|
runtime: commandRuntime(result),
|
|
628
|
+
source: await fileArtifact(input),
|
|
618
629
|
artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
|
|
619
630
|
};
|
|
620
631
|
}
|