@tiwater/office-mcp 0.21.53 → 0.21.55
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/contracts/docx_collapse_trailing_empty_section.schema.json +12 -0
- package/office/contracts/docx_read_all_tables.schema.json +22 -0
- package/office/contracts/docx_set_section_margins.schema.json +24 -0
- package/office/contracts/tiwater-office-provider-contract-manifest-v1.json +34 -1
- package/office/index.mjs +49 -0
- package/package.json +1 -1
- package/pdf/contracts/tiwater-pdf-provider-contract-manifest-v1.json +1 -1
- package/text/contracts/tiwater-text-provider-contract-manifest-v1.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "tiwater.office-mcp-input/docx_collapse_trailing_empty_section",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"input": { "type": "string", "minLength": 1, "x-tiwater-file-role": "read", "x-tiwater-document-revision-role": "current" },
|
|
7
|
+
"output": { "type": "string", "minLength": 1, "description": "Output DOCX path; may equal input for an atomic in-place update.", "x-tiwater-file-role": "write" },
|
|
8
|
+
"receiptOutput": { "type": "string", "minLength": 1, "x-tiwater-file-role": "write", "x-tiwater-file-effect": false }
|
|
9
|
+
},
|
|
10
|
+
"required": ["input", "output", "receiptOutput"],
|
|
11
|
+
"additionalProperties": false
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "tiwater.office-mcp-input/docx_read_all_tables/v1",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"input": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"minLength": 1,
|
|
9
|
+
"description": "Current DOCX to read once.",
|
|
10
|
+
"x-tiwater-file-role": "read"
|
|
11
|
+
},
|
|
12
|
+
"output": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"minLength": 1,
|
|
15
|
+
"description": "New JSON file that receives every native table in document order, including rows, cells, merges, paragraphs, and text nodes.",
|
|
16
|
+
"x-tiwater-file-role": "write",
|
|
17
|
+
"x-tiwater-file-effect": false
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": ["input", "output"],
|
|
21
|
+
"additionalProperties": false
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "tiwater.office-mcp-input/docx_set_section_margins",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"input": { "type": "string", "minLength": 1, "x-tiwater-file-role": "read", "x-tiwater-document-revision-role": "current" },
|
|
7
|
+
"changes": { "type": "array", "minItems": 1, "items": { "type": "object", "properties": {
|
|
8
|
+
"sectionIndex": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
|
|
9
|
+
"unit": { "type": "string", "const": "twip", "description": "Unit for every supplied margin value." },
|
|
10
|
+
"margins": { "type": "object", "description": "At least one margin must be supplied; omitted margins remain unchanged.", "properties": {
|
|
11
|
+
"top": { "type": "integer", "minimum": 0, "maximum": 31680 },
|
|
12
|
+
"bottom": { "type": "integer", "minimum": 0, "maximum": 31680 },
|
|
13
|
+
"left": { "type": "integer", "minimum": 0, "maximum": 31680 },
|
|
14
|
+
"right": { "type": "integer", "minimum": 0, "maximum": 31680 },
|
|
15
|
+
"header": { "type": "integer", "minimum": 0, "maximum": 31680 },
|
|
16
|
+
"footer": { "type": "integer", "minimum": 0, "maximum": 31680 }
|
|
17
|
+
}, "additionalProperties": false }
|
|
18
|
+
}, "required": ["sectionIndex", "unit", "margins"], "additionalProperties": false } },
|
|
19
|
+
"output": { "type": "string", "minLength": 1, "description": "Output DOCX path; may equal input for an atomic in-place update.", "x-tiwater-file-role": "write" },
|
|
20
|
+
"receiptOutput": { "type": "string", "minLength": 1, "x-tiwater-file-role": "write", "x-tiwater-file-effect": false }
|
|
21
|
+
},
|
|
22
|
+
"required": ["input", "changes", "output", "receiptOutput"],
|
|
23
|
+
"additionalProperties": false
|
|
24
|
+
}
|
|
@@ -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.55"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
@@ -27,6 +27,17 @@
|
|
|
27
27
|
"sha256": "975fd24572ae28fb2181edaae9da856417cdcd657f8d83c5eb46c3ff069d2376"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
"name": "docx_collapse_trailing_empty_section",
|
|
32
|
+
"providerContract": {
|
|
33
|
+
"source": "packages/docx-cli/contracts/mcp-input/docx_collapse_trailing_empty_section.schema.json",
|
|
34
|
+
"sha256": "aa111bc52626aad17c6a7efd9af1b31a0209c7e40811ba0b80cc96bddf6553ac"
|
|
35
|
+
},
|
|
36
|
+
"inputContract": {
|
|
37
|
+
"path": "office/contracts/docx_collapse_trailing_empty_section.schema.json",
|
|
38
|
+
"sha256": "aa111bc52626aad17c6a7efd9af1b31a0209c7e40811ba0b80cc96bddf6553ac"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
30
41
|
{
|
|
31
42
|
"name": "docx_compare",
|
|
32
43
|
"providerContract": {
|
|
@@ -148,6 +159,17 @@
|
|
|
148
159
|
"sha256": "4ba37e5570ea7958c374111ae7c0f6460eec29937e5c822eba44eb1b8e908d17"
|
|
149
160
|
}
|
|
150
161
|
},
|
|
162
|
+
{
|
|
163
|
+
"name": "docx_read_all_tables",
|
|
164
|
+
"providerContract": {
|
|
165
|
+
"source": "packages/docx-cli/contracts/mcp-input/docx_read_all_tables.schema.json",
|
|
166
|
+
"sha256": "a5a22e6368977d620af1c53cc934d8934550734069d7ef7f65fc434e4136ae62"
|
|
167
|
+
},
|
|
168
|
+
"inputContract": {
|
|
169
|
+
"path": "office/contracts/docx_read_all_tables.schema.json",
|
|
170
|
+
"sha256": "a5a22e6368977d620af1c53cc934d8934550734069d7ef7f65fc434e4136ae62"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
151
173
|
{
|
|
152
174
|
"name": "docx_read_object",
|
|
153
175
|
"providerContract": {
|
|
@@ -214,6 +236,17 @@
|
|
|
214
236
|
"sha256": "02343da9dd2072257781e7e94a07682639f3de80b4bec0c7d9c0fc5da6a3b2f5"
|
|
215
237
|
}
|
|
216
238
|
},
|
|
239
|
+
{
|
|
240
|
+
"name": "docx_set_section_margins",
|
|
241
|
+
"providerContract": {
|
|
242
|
+
"source": "packages/docx-cli/contracts/mcp-input/docx_set_section_margins.schema.json",
|
|
243
|
+
"sha256": "7a58c93c36789394fa624d1dbba617346685e2dc3fd74b9bbae76c124a97b1a1"
|
|
244
|
+
},
|
|
245
|
+
"inputContract": {
|
|
246
|
+
"path": "office/contracts/docx_set_section_margins.schema.json",
|
|
247
|
+
"sha256": "7a58c93c36789394fa624d1dbba617346685e2dc3fd74b9bbae76c124a97b1a1"
|
|
248
|
+
}
|
|
249
|
+
},
|
|
217
250
|
{
|
|
218
251
|
"name": "docx_set_table",
|
|
219
252
|
"providerContract": {
|
package/office/index.mjs
CHANGED
|
@@ -534,6 +534,15 @@ const docxTableReadOutput = docxObservationOutput('docx_read_table').extend({
|
|
|
534
534
|
}).strict()).optional(),
|
|
535
535
|
}).strict();
|
|
536
536
|
|
|
537
|
+
const docxReadAllTablesOutput = z.object({
|
|
538
|
+
tool: z.literal('docx_read_all_tables'),
|
|
539
|
+
runtime: runtimeIdentity,
|
|
540
|
+
source: artifact,
|
|
541
|
+
artifact,
|
|
542
|
+
schema: z.literal('tiwater.docx-table-read-set/v1'),
|
|
543
|
+
tableCount: z.number().int().nonnegative(),
|
|
544
|
+
}).strict();
|
|
545
|
+
|
|
537
546
|
const docxReadObjectOutput = docxObservationOutput('docx_read_object').extend({
|
|
538
547
|
receipt: z.object({
|
|
539
548
|
schema: z.literal('tiwater.docx-read-object-receipt/v1'),
|
|
@@ -595,6 +604,14 @@ const tools = [
|
|
|
595
604
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
596
605
|
handler: args => docxObservation('docx_read_table', args),
|
|
597
606
|
},
|
|
607
|
+
{
|
|
608
|
+
name: 'docx_read_all_tables',
|
|
609
|
+
description: 'Read every native table from one current DOCX in document order. The document is opened once and the complete rows, cells, merge ownership, paragraphs, and text nodes are written to output. Only a compact receipt is returned. This tool does not select business tables or infer their meaning.',
|
|
610
|
+
inputSchema: inputContract('docx_read_all_tables'),
|
|
611
|
+
outputSchema: docxReadAllTablesOutput,
|
|
612
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
613
|
+
handler: docxReadAllTables,
|
|
614
|
+
},
|
|
598
615
|
{
|
|
599
616
|
name: 'docx_replace_content_from_source',
|
|
600
617
|
effectKind: 'document-mutation',
|
|
@@ -635,6 +652,22 @@ const tools = [
|
|
|
635
652
|
outputSchema: fixedEditOutput('docx_set_table_width'),
|
|
636
653
|
handler: (args, tool) => fixedEdit(tool, args, docxCandidates),
|
|
637
654
|
},
|
|
655
|
+
{
|
|
656
|
+
name: 'docx_set_section_margins',
|
|
657
|
+
effectKind: 'document-mutation',
|
|
658
|
+
description: 'Atomically set explicitly supplied page or header/footer margins on selected current DOCX sections. Sections use zero-based native document order, values use twips, and omitted margins remain unchanged. This does not select sections, calculate layout clearance, insert content, or decide business formatting.',
|
|
659
|
+
inputSchema: inputContract('docx_set_section_margins'),
|
|
660
|
+
outputSchema: fixedEditOutput('docx_set_section_margins'),
|
|
661
|
+
handler: (args, tool) => fixedEdit(tool, args, docxCandidates),
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
name: 'docx_collapse_trailing_empty_section',
|
|
665
|
+
effectKind: 'document-mutation',
|
|
666
|
+
description: 'Atomically remove exactly one observed trailing empty DOCX section by promoting the preceding section properties and removing only intervening empty paragraphs. The operation fails when that native structure is absent and preserves all visible document content. This does not choose business sections, delete nonempty content, or normalize other section breaks.',
|
|
667
|
+
inputSchema: inputContract('docx_collapse_trailing_empty_section'),
|
|
668
|
+
outputSchema: fixedEditOutput('docx_collapse_trailing_empty_section'),
|
|
669
|
+
handler: (args, tool) => fixedEdit(tool, args, docxCandidates),
|
|
670
|
+
},
|
|
638
671
|
{
|
|
639
672
|
name: 'docx_set_table',
|
|
640
673
|
effectKind: 'document-mutation',
|
|
@@ -1214,6 +1247,22 @@ async function docxObservation(tool, args) {
|
|
|
1214
1247
|
});
|
|
1215
1248
|
}
|
|
1216
1249
|
|
|
1250
|
+
async function docxReadAllTables(args) {
|
|
1251
|
+
const input = path.resolve(requireString(args.input, 'input'));
|
|
1252
|
+
const output = path.resolve(requireString(args.output, 'output'));
|
|
1253
|
+
return withTempJsonFile({ input }, async requestPath => {
|
|
1254
|
+
const result = await runJsonCandidateChain(docxCandidates, ['docx_read_all_tables', requestPath]);
|
|
1255
|
+
return {
|
|
1256
|
+
tool: 'docx_read_all_tables',
|
|
1257
|
+
runtime: commandRuntime(result),
|
|
1258
|
+
source: await fileArtifact(input),
|
|
1259
|
+
artifact: await writeIdempotentJsonArtifact(output, result.json),
|
|
1260
|
+
schema: result.json.schema,
|
|
1261
|
+
tableCount: result.json.tables.length,
|
|
1262
|
+
};
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1217
1266
|
async function docxReadObject(args) {
|
|
1218
1267
|
const input = path.resolve(requireString(args.input, 'input'));
|
|
1219
1268
|
const delivery = resultChannels(args);
|
package/package.json
CHANGED