@tiwater/office-mcp 0.21.30 → 0.21.31
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/_shared/evidence-role.mjs +123 -0
- package/office/contracts/docx_export_json.schema.json +2 -1
- package/office/contracts/docx_inspect.schema.json +2 -1
- package/office/contracts/pptx_export_json.schema.json +2 -1
- package/office/contracts/pptx_inspect.schema.json +2 -1
- package/office/contracts/tiwater-office-provider-contract-manifest-v1.json +13 -13
- package/office/contracts/xlsx_export_json.schema.json +2 -1
- package/office/contracts/xlsx_inspect.schema.json +2 -1
- package/office/index.mjs +16 -6
- package/package.json +2 -1
- package/pdf/contracts/tiwater-pdf-provider-contract-manifest-v1.json +1 -1
- package/pdf/index.mjs +3 -0
- package/text/contracts/text_inspect.schema.json +2 -1
- package/text/contracts/tiwater-text-provider-contract-manifest-v1.json +3 -3
- package/text/index.mjs +3 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export const evidenceRoleMetadataKey = 'x-tiwater-evidence-role';
|
|
2
|
+
export const evidenceRoleSchema = 'tiwater.provider-evidence-role/v1';
|
|
3
|
+
|
|
4
|
+
const evidenceRoles = new Set([
|
|
5
|
+
'document-observation',
|
|
6
|
+
'final-readback',
|
|
7
|
+
'native-render',
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
export function evidenceRoleMetadata(role) {
|
|
11
|
+
if (!evidenceRoles.has(role)) throw new Error(`unsupported-evidence-role:${role}`);
|
|
12
|
+
return {
|
|
13
|
+
[evidenceRoleMetadataKey]: {
|
|
14
|
+
schema: evidenceRoleSchema,
|
|
15
|
+
role,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function assertEvidenceToolContract(tool, expectedRole) {
|
|
21
|
+
const metadata = tool?._meta?.[evidenceRoleMetadataKey];
|
|
22
|
+
if (!metadata || Object.keys(metadata).sort().join(',') !== 'role,schema'
|
|
23
|
+
|| metadata.schema !== evidenceRoleSchema || metadata.role !== expectedRole) {
|
|
24
|
+
throw new Error(`evidence-role-metadata-invalid:${tool?.name || 'unnamed'}`);
|
|
25
|
+
}
|
|
26
|
+
const bindings = fileBindings(tool.inputSchema);
|
|
27
|
+
if (!bindings.some(binding => binding.role === 'read')) {
|
|
28
|
+
throw new Error(`evidence-role-source-binding-missing:${tool.name}`);
|
|
29
|
+
}
|
|
30
|
+
if (!tool.outputSchema || typeof tool.outputSchema !== 'object') {
|
|
31
|
+
throw new Error(`evidence-role-output-schema-missing:${tool.name}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (expectedRole === 'native-render') {
|
|
35
|
+
assertAnnotations(tool, false, false);
|
|
36
|
+
if (!bindings.some(binding => binding.role === 'write' && binding.effect)
|
|
37
|
+
|| !bindings.some(binding => binding.role === 'write' && !binding.effect)
|
|
38
|
+
|| !requiredArtifact(tool.outputSchema, 'receipt')) {
|
|
39
|
+
throw new Error(`native-render-evidence-contract-invalid:${tool.name}`);
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
assertAnnotations(tool, true, true);
|
|
45
|
+
const writes = bindings.filter(binding => binding.role === 'write');
|
|
46
|
+
if (writes.length < 1 || writes.some(binding => binding.effect)) {
|
|
47
|
+
throw new Error(`read-evidence-artifact-binding-invalid:${tool.name}`);
|
|
48
|
+
}
|
|
49
|
+
if (!sourceIdentity(tool.outputSchema) || !requiredArtifact(tool.outputSchema, 'artifact')) {
|
|
50
|
+
throw new Error(`read-evidence-output-binding-invalid:${tool.name}`);
|
|
51
|
+
}
|
|
52
|
+
if (expectedRole === 'document-observation') {
|
|
53
|
+
const identity = requiredObject(tool.outputSchema, 'identity') || requiredObject(tool.outputSchema, 'summary');
|
|
54
|
+
if (!identity || unboundedArrays(identity).length > 0) {
|
|
55
|
+
throw new Error(`document-observation-identity-unbounded:${tool.name}`);
|
|
56
|
+
}
|
|
57
|
+
} else if (!requiredObject(tool.outputSchema, 'receipt')) {
|
|
58
|
+
throw new Error(`final-readback-receipt-missing:${tool.name}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function assertAnnotations(tool, readOnlyHint, idempotentHint) {
|
|
63
|
+
const annotations = tool.annotations || {};
|
|
64
|
+
if (annotations.readOnlyHint !== readOnlyHint
|
|
65
|
+
|| annotations.idempotentHint !== idempotentHint
|
|
66
|
+
|| annotations.destructiveHint !== false
|
|
67
|
+
|| annotations.openWorldHint !== false) {
|
|
68
|
+
throw new Error(`evidence-role-annotations-invalid:${tool.name}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function fileBindings(schema) {
|
|
73
|
+
const bindings = [];
|
|
74
|
+
function visit(node) {
|
|
75
|
+
if (!node || typeof node !== 'object' || Array.isArray(node)) return;
|
|
76
|
+
if (node['x-tiwater-file-role'] === 'read' || node['x-tiwater-file-role'] === 'write') {
|
|
77
|
+
bindings.push({
|
|
78
|
+
role: node['x-tiwater-file-role'],
|
|
79
|
+
effect: node['x-tiwater-file-role'] === 'write' && node['x-tiwater-file-effect'] !== false,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
for (const child of Object.values(node.properties || {})) visit(child);
|
|
83
|
+
if (node.items) visit(node.items);
|
|
84
|
+
for (const keyword of ['allOf', 'anyOf', 'oneOf']) {
|
|
85
|
+
for (const child of node[keyword] || []) visit(child);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
visit(schema);
|
|
89
|
+
return bindings;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function requiredObject(schema, property) {
|
|
93
|
+
const value = schema?.properties?.[property];
|
|
94
|
+
return schema?.required?.includes(property) && value?.type === 'object' ? value : null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function artifactShape(schema) {
|
|
98
|
+
const candidate = schema?.anyOf?.find(value => value?.type === 'object') || schema;
|
|
99
|
+
return candidate?.type === 'object'
|
|
100
|
+
&& ['path', 'sha256', 'bytes'].every(property => candidate.required?.includes(property));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function requiredArtifact(schema, property) {
|
|
104
|
+
return schema?.required?.includes(property) && artifactShape(schema?.properties?.[property]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function sourceIdentity(schema) {
|
|
108
|
+
if (requiredArtifact(schema, 'source')) return true;
|
|
109
|
+
const sources = schema?.properties?.sources;
|
|
110
|
+
return schema?.required?.includes('sources') && sources?.type === 'array'
|
|
111
|
+
&& Number.isInteger(sources.maxItems) && artifactShape(sources.items);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function unboundedArrays(schema, location = '$', found = []) {
|
|
115
|
+
if (Array.isArray(schema)) {
|
|
116
|
+
schema.forEach((child, index) => unboundedArrays(child, `${location}[${index}]`, found));
|
|
117
|
+
return found;
|
|
118
|
+
}
|
|
119
|
+
if (!schema || typeof schema !== 'object') return found;
|
|
120
|
+
if (schema.type === 'array' && !Number.isInteger(schema.maxItems)) found.push(location);
|
|
121
|
+
for (const [key, child] of Object.entries(schema)) unboundedArrays(child, `${location}.${key}`, found);
|
|
122
|
+
return found;
|
|
123
|
+
}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"type": "string",
|
|
16
16
|
"minLength": 1,
|
|
17
17
|
"description": "Absolute path for a new JSON artifact inside the caller-authorized output directory. Existing files are never overwritten.",
|
|
18
|
-
"x-tiwater-file-role": "write"
|
|
18
|
+
"x-tiwater-file-role": "write",
|
|
19
|
+
"x-tiwater-file-effect": false
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
"required": [
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"type": "string",
|
|
16
16
|
"minLength": 1,
|
|
17
17
|
"description": "Optional absolute path for retaining the complete observation inside the caller-authorized output directory; existing files are never overwritten. May be combined with returnContent.",
|
|
18
|
-
"x-tiwater-file-role": "write"
|
|
18
|
+
"x-tiwater-file-role": "write",
|
|
19
|
+
"x-tiwater-file-effect": false
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
"required": [
|
|
@@ -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.21.
|
|
5
|
+
"version": "0.21.31"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"name": "docx_export_json",
|
|
65
65
|
"providerContract": {
|
|
66
66
|
"source": "packages/docx-cli/contracts/mcp-input/docx_export_json.schema.json",
|
|
67
|
-
"sha256": "
|
|
67
|
+
"sha256": "995eb1a5a8992e2a2186f2d7621b5eea7875eecd78ce153e77964d2942db2211"
|
|
68
68
|
},
|
|
69
69
|
"inputContract": {
|
|
70
70
|
"path": "office/contracts/docx_export_json.schema.json",
|
|
71
|
-
"sha256": "
|
|
71
|
+
"sha256": "995eb1a5a8992e2a2186f2d7621b5eea7875eecd78ce153e77964d2942db2211"
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
{
|
|
@@ -108,11 +108,11 @@
|
|
|
108
108
|
"name": "docx_inspect",
|
|
109
109
|
"providerContract": {
|
|
110
110
|
"source": "packages/docx-cli/contracts/mcp-input/docx_inspect.schema.json",
|
|
111
|
-
"sha256": "
|
|
111
|
+
"sha256": "a7d00a4caa5983d5dbf210eade9ebcc345afaa9f6c72dcae37978447ad180259"
|
|
112
112
|
},
|
|
113
113
|
"inputContract": {
|
|
114
114
|
"path": "office/contracts/docx_inspect.schema.json",
|
|
115
|
-
"sha256": "
|
|
115
|
+
"sha256": "a7d00a4caa5983d5dbf210eade9ebcc345afaa9f6c72dcae37978447ad180259"
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
118
|
{
|
|
@@ -328,22 +328,22 @@
|
|
|
328
328
|
"name": "pptx_export_json",
|
|
329
329
|
"providerContract": {
|
|
330
330
|
"source": "packages/pptx-cli/contracts/mcp-input/pptx_export_json.schema.json",
|
|
331
|
-
"sha256": "
|
|
331
|
+
"sha256": "9cde8fdda335f379d44e60819367b305a2c97c6c0c8fdf2141bf460335e5da84"
|
|
332
332
|
},
|
|
333
333
|
"inputContract": {
|
|
334
334
|
"path": "office/contracts/pptx_export_json.schema.json",
|
|
335
|
-
"sha256": "
|
|
335
|
+
"sha256": "9cde8fdda335f379d44e60819367b305a2c97c6c0c8fdf2141bf460335e5da84"
|
|
336
336
|
}
|
|
337
337
|
},
|
|
338
338
|
{
|
|
339
339
|
"name": "pptx_inspect",
|
|
340
340
|
"providerContract": {
|
|
341
341
|
"source": "packages/pptx-cli/contracts/mcp-input/pptx_inspect.schema.json",
|
|
342
|
-
"sha256": "
|
|
342
|
+
"sha256": "9cde8fdda335f379d44e60819367b305a2c97c6c0c8fdf2141bf460335e5da84"
|
|
343
343
|
},
|
|
344
344
|
"inputContract": {
|
|
345
345
|
"path": "office/contracts/pptx_inspect.schema.json",
|
|
346
|
-
"sha256": "
|
|
346
|
+
"sha256": "9cde8fdda335f379d44e60819367b305a2c97c6c0c8fdf2141bf460335e5da84"
|
|
347
347
|
}
|
|
348
348
|
},
|
|
349
349
|
{
|
|
@@ -427,11 +427,11 @@
|
|
|
427
427
|
"name": "xlsx_export_json",
|
|
428
428
|
"providerContract": {
|
|
429
429
|
"source": "packages/xlsx-cli/contracts/mcp-input/xlsx_export_json.schema.json",
|
|
430
|
-
"sha256": "
|
|
430
|
+
"sha256": "3943fa01506e5b9ea1cb0ecfd13fc484c16ec96245af462c9a6a37377f2a7a82"
|
|
431
431
|
},
|
|
432
432
|
"inputContract": {
|
|
433
433
|
"path": "office/contracts/xlsx_export_json.schema.json",
|
|
434
|
-
"sha256": "
|
|
434
|
+
"sha256": "3943fa01506e5b9ea1cb0ecfd13fc484c16ec96245af462c9a6a37377f2a7a82"
|
|
435
435
|
}
|
|
436
436
|
},
|
|
437
437
|
{
|
|
@@ -449,11 +449,11 @@
|
|
|
449
449
|
"name": "xlsx_inspect",
|
|
450
450
|
"providerContract": {
|
|
451
451
|
"source": "packages/xlsx-cli/contracts/mcp-input/xlsx_inspect.schema.json",
|
|
452
|
-
"sha256": "
|
|
452
|
+
"sha256": "9cde8fdda335f379d44e60819367b305a2c97c6c0c8fdf2141bf460335e5da84"
|
|
453
453
|
},
|
|
454
454
|
"inputContract": {
|
|
455
455
|
"path": "office/contracts/xlsx_inspect.schema.json",
|
|
456
|
-
"sha256": "
|
|
456
|
+
"sha256": "9cde8fdda335f379d44e60819367b305a2c97c6c0c8fdf2141bf460335e5da84"
|
|
457
457
|
}
|
|
458
458
|
},
|
|
459
459
|
{
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"type": "string",
|
|
16
16
|
"minLength": 1,
|
|
17
17
|
"description": "New JSON artifact path. Existing files are never overwritten.",
|
|
18
|
-
"x-tiwater-file-role": "write"
|
|
18
|
+
"x-tiwater-file-role": "write",
|
|
19
|
+
"x-tiwater-file-effect": false
|
|
19
20
|
},
|
|
20
21
|
"resolveMergedCells": {
|
|
21
22
|
"description": "Resolve merged cells to project values.",
|
package/office/index.mjs
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
writeJsonArtifact,
|
|
24
24
|
} from '../_shared/large-json-result.mjs';
|
|
25
25
|
import { withOutputWriteLock } from '../_shared/output-write-lock.mjs';
|
|
26
|
+
import { evidenceRoleMetadata } from '../_shared/evidence-role.mjs';
|
|
26
27
|
import { compactDocxObjectIdentity } from './docx-object-identity.mjs';
|
|
27
28
|
|
|
28
29
|
const packageMetadata = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
|
|
@@ -424,10 +425,11 @@ const docxReadObjectOutput = docxObservationOutput('docx_read_object').extend({
|
|
|
424
425
|
const tools = [
|
|
425
426
|
{
|
|
426
427
|
name: 'docx_inspect',
|
|
428
|
+
evidenceRole: 'document-observation',
|
|
427
429
|
description: 'Inspect one current DOCX for identity and package overview. The response always includes a bounded identity summary. Set returnContent true when that summary is the requested direct result. Provide output to retain the complete machine observation and return its artifact receipt. These channels are independent and may be used together. At least one channel is required. Use list and read operations to traverse selected document objects in native structure order. This overview is not a complete final-document readback; use docx_export_json when a downstream consumer requires the complete body projection.',
|
|
428
430
|
inputSchema: inputContract('docx_inspect'),
|
|
429
431
|
outputSchema: docxInspectionOutput('docx_inspect'),
|
|
430
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
432
|
+
annotations: { readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: false },
|
|
431
433
|
handler: docxInspect,
|
|
432
434
|
},
|
|
433
435
|
{
|
|
@@ -549,10 +551,11 @@ const tools = [
|
|
|
549
551
|
},
|
|
550
552
|
{
|
|
551
553
|
name: 'docx_export_json',
|
|
554
|
+
evidenceRole: 'final-readback',
|
|
552
555
|
description: 'Produce the complete body-only DOCX JSON projection required for final-document readback or another downstream consumer of that format. Set returnContent true to return the complete result when it fits the response limit. Provide output to write the complete result to a new JSON file. The two choices are independent and may be used together; at least one is required. This does not replace bounded list and read operations during document processing.',
|
|
553
556
|
inputSchema: inputContract('docx_export_json'),
|
|
554
557
|
outputSchema: largeResultOutput('docx_export_json'),
|
|
555
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
558
|
+
annotations: { readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: false },
|
|
556
559
|
handler: docxExportJson,
|
|
557
560
|
},
|
|
558
561
|
{
|
|
@@ -614,9 +617,11 @@ const tools = [
|
|
|
614
617
|
},
|
|
615
618
|
{
|
|
616
619
|
name: 'office_render_pdf',
|
|
620
|
+
evidenceRole: 'native-render',
|
|
617
621
|
description: 'Render a current Office document to PDF with its required native WPS backend and write the complete provider receipt as evidence. The input extension selects Writer, Spreadsheets, or Presentation; fallback rendering is rejected.',
|
|
618
622
|
inputSchema: inputContract('office_render_pdf'),
|
|
619
623
|
outputSchema: nativeRenderOutput,
|
|
624
|
+
annotations: { readOnlyHint: false, idempotentHint: false, destructiveHint: false, openWorldHint: false },
|
|
620
625
|
handler: officeRenderPdf,
|
|
621
626
|
},
|
|
622
627
|
{
|
|
@@ -627,18 +632,20 @@ const tools = [
|
|
|
627
632
|
},
|
|
628
633
|
{
|
|
629
634
|
name: 'xlsx_inspect',
|
|
635
|
+
evidenceRole: 'document-observation',
|
|
630
636
|
description: 'Inspect a current XLSX workbook or legacy XLS workbook, including workbook structure, exported values, formulas, styles, merged ranges, and published legacy-format conversion evidence. Set returnContent true to return the complete result when it fits the response limit. Provide output to write the complete result to a new JSON file. The two choices are independent and may be used together; at least one is required.',
|
|
631
637
|
inputSchema: inputContract('xlsx_inspect'),
|
|
632
638
|
outputSchema: largeInspectionOutput('xlsx_inspect', xlsxInspectionSummary),
|
|
633
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
639
|
+
annotations: { readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: false },
|
|
634
640
|
handler: xlsxInspect,
|
|
635
641
|
},
|
|
636
642
|
{
|
|
637
643
|
name: 'xlsx_export_json',
|
|
644
|
+
evidenceRole: 'final-readback',
|
|
638
645
|
description: 'Export workbook sheet data from XLSX as structured JSON. Set returnContent true to return the complete result when it fits the response limit. Provide output to write the complete result to a new JSON file. The two choices are independent and may be used together; at least one is required.',
|
|
639
646
|
inputSchema: inputContract('xlsx_export_json'),
|
|
640
647
|
outputSchema: largeResultOutput('xlsx_export_json'),
|
|
641
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
648
|
+
annotations: { readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: false },
|
|
642
649
|
handler: xlsxExportJson,
|
|
643
650
|
},
|
|
644
651
|
{
|
|
@@ -660,18 +667,20 @@ const tools = [
|
|
|
660
667
|
},
|
|
661
668
|
{
|
|
662
669
|
name: 'pptx_inspect',
|
|
670
|
+
evidenceRole: 'document-observation',
|
|
663
671
|
description: 'Inspect a PPTX file, including slides, masters, layouts, shapes, transforms, paragraphs, runs, and placeholders. Set returnContent true to return the complete result when it fits the response limit. Provide output to write the complete result to a new JSON file. The two choices are independent and may be used together; at least one is required.',
|
|
664
672
|
inputSchema: inputContract('pptx_inspect'),
|
|
665
673
|
outputSchema: largeInspectionOutput('pptx_inspect', pptxInspectionSummary),
|
|
666
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
674
|
+
annotations: { readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: false },
|
|
667
675
|
handler: pptxInspect,
|
|
668
676
|
},
|
|
669
677
|
{
|
|
670
678
|
name: 'pptx_export_json',
|
|
679
|
+
evidenceRole: 'final-readback',
|
|
671
680
|
description: 'Export PPTX slide text, notes, and placeholder hints as structured JSON. Set returnContent true to return the complete result when it fits the response limit. Provide output to write the complete result to a new JSON file. The two choices are independent and may be used together; at least one is required.',
|
|
672
681
|
inputSchema: inputContract('pptx_export_json'),
|
|
673
682
|
outputSchema: largeResultOutput('pptx_export_json'),
|
|
674
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
683
|
+
annotations: { readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: false },
|
|
675
684
|
handler: pptxExportJson,
|
|
676
685
|
},
|
|
677
686
|
{
|
|
@@ -727,6 +736,7 @@ function buildServer() {
|
|
|
727
736
|
inputSchema: tool.inputSchema,
|
|
728
737
|
...(tool.outputSchema ? { outputSchema: tool.outputSchema } : {}),
|
|
729
738
|
...(tool.annotations ? { annotations: tool.annotations } : {}),
|
|
739
|
+
...(tool.evidenceRole ? { _meta: evidenceRoleMetadata(tool.evidenceRole) } : {}),
|
|
730
740
|
},
|
|
731
741
|
async args => {
|
|
732
742
|
const payload = typeof args.output === 'string'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiwater/office-mcp",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.31",
|
|
4
4
|
"description": "Published MCP distribution for independent Tiwater Office, PDF, and Text document capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"_shared/large-json-result.mjs",
|
|
23
23
|
"_shared/output-write-lock.mjs",
|
|
24
24
|
"_shared/mcp-stdio.mjs",
|
|
25
|
+
"_shared/evidence-role.mjs",
|
|
25
26
|
"office/index.mjs",
|
|
26
27
|
"office/docx-object-identity.mjs",
|
|
27
28
|
"office/README.md",
|
package/pdf/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
7
|
|
|
8
8
|
import { deliverLargeJsonResult } from '../_shared/large-json-result.mjs';
|
|
9
9
|
import { McpStdioServer } from '../_shared/mcp-stdio.mjs';
|
|
10
|
+
import { evidenceRoleMetadata } from '../_shared/evidence-role.mjs';
|
|
10
11
|
import {
|
|
11
12
|
commandCandidate,
|
|
12
13
|
createToolResult,
|
|
@@ -110,6 +111,7 @@ const definitions = new Map([
|
|
|
110
111
|
['pdf_inspect', {
|
|
111
112
|
description: 'Inspect one current PDF revision. Always retain the complete observation at output and return a bounded identity containing page and document metadata without traversing document content.',
|
|
112
113
|
outputSchema: inspectOutputSchema,
|
|
114
|
+
evidenceRole: 'document-observation',
|
|
113
115
|
}],
|
|
114
116
|
['pdf_extract_tables', {
|
|
115
117
|
description: 'Extract tables from selected current PDF pages with deterministic published extraction. Set returnContent true to return complete bounded content; provide output to retain the complete immutable result. At least one result channel is required.',
|
|
@@ -142,6 +144,7 @@ const tools = manifest.tools.map((entry) => {
|
|
|
142
144
|
description: definition.description,
|
|
143
145
|
inputSchema: JSON.parse(bytes.toString('utf8')),
|
|
144
146
|
outputSchema: definition.outputSchema,
|
|
147
|
+
...(definition.evidenceRole ? { _meta: evidenceRoleMetadata(definition.evidenceRole) } : {}),
|
|
145
148
|
annotations: {
|
|
146
149
|
readOnlyHint: true,
|
|
147
150
|
idempotentHint: true,
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"type": "string",
|
|
17
17
|
"minLength": 1,
|
|
18
18
|
"description": "New immutable JSON artifact path for the complete inspection.",
|
|
19
|
-
"x-tiwater-file-role": "write"
|
|
19
|
+
"x-tiwater-file-role": "write",
|
|
20
|
+
"x-tiwater-file-effect": false
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
"required": ["input", "returnContent", "output"],
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
"schema": "tiwater.text-provider-contract-manifest/v1",
|
|
3
3
|
"provider": {
|
|
4
4
|
"id": "@tiwater/office-mcp",
|
|
5
|
-
"version": "0.21.
|
|
5
|
+
"version": "0.21.31"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
9
9
|
"name": "text_inspect",
|
|
10
10
|
"providerContract": {
|
|
11
11
|
"source": "servers/text/provider-contracts/text_inspect.schema.json",
|
|
12
|
-
"sha256": "
|
|
12
|
+
"sha256": "7a4af90303d2a0abce66a2e77f83838dbb2ea925edf98b04a80723b92b7f5ec0"
|
|
13
13
|
},
|
|
14
14
|
"inputContract": {
|
|
15
15
|
"path": "text/contracts/text_inspect.schema.json",
|
|
16
|
-
"sha256": "
|
|
16
|
+
"sha256": "7a4af90303d2a0abce66a2e77f83838dbb2ea925edf98b04a80723b92b7f5ec0"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
{
|
package/text/index.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { serveStdio } from '@modelcontextprotocol/server/stdio';
|
|
|
9
9
|
import { createToolResult } from '../_shared/tool-runtime.mjs';
|
|
10
10
|
import { deliverLargeJsonResult } from '../_shared/large-json-result.mjs';
|
|
11
11
|
import { withOutputWriteLock } from '../_shared/output-write-lock.mjs';
|
|
12
|
+
import { evidenceRoleMetadata } from '../_shared/evidence-role.mjs';
|
|
12
13
|
import { inspectText, readTextLines } from './observation.mjs';
|
|
13
14
|
|
|
14
15
|
const packageMetadata = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
|
|
@@ -105,6 +106,7 @@ function largeResultOutput(contentSchema) {
|
|
|
105
106
|
const definitions = [
|
|
106
107
|
{
|
|
107
108
|
name: 'text_inspect',
|
|
109
|
+
evidenceRole: 'document-observation',
|
|
108
110
|
description: 'Inspect one exact supported plain-text revision. Return its byte identity, lossless encoding and BOM facts, line count, and at most eight opening line identities while retaining the complete bounded inspection at output. It does not parse fields, records, key-value pairs, sections, or markup.',
|
|
109
111
|
outputSchema: largeResultOutput(inspectContent).extend({ identity: inspectIdentity }).strict(),
|
|
110
112
|
handler: textInspect,
|
|
@@ -137,6 +139,7 @@ function buildServer() {
|
|
|
137
139
|
destructiveHint: false,
|
|
138
140
|
openWorldHint: false,
|
|
139
141
|
},
|
|
142
|
+
...(definition.evidenceRole ? { _meta: evidenceRoleMetadata(definition.evidenceRole) } : {}),
|
|
140
143
|
},
|
|
141
144
|
async args => {
|
|
142
145
|
const payload = typeof args.output === 'string'
|