@tiwater/office-mcp 0.16.8 → 0.16.10
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 +6 -4
- package/office/contracts/docx_copy_table_rows.schema.json +83 -0
- package/office/contracts/tiwater-office-provider-contract-manifest-v1.json +12 -12
- package/office/index.mjs +7 -20
- package/package.json +1 -1
- package/office/contracts/docx_inspect_tables.schema.json +0 -22
package/office/README.md
CHANGED
|
@@ -43,10 +43,12 @@ DOCX mutations accept revision-bound native object references. Physical table,
|
|
|
43
43
|
row, column, paragraph, run, drawing, and body indexes are not public mutation
|
|
44
44
|
addresses.
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
Table-row copying is a distinct bulk table responsibility: the caller selects
|
|
47
|
+
current source and target tables, bounded row regions, excluded source rows,
|
|
48
|
+
and source/target columns. The provider expands the target region, preserves
|
|
49
|
+
target presentation, carries selected source paragraph content, and reproduces
|
|
50
|
+
the selected source row order and merge topology. It does not infer business
|
|
51
|
+
identity, language, row scope, or column meaning.
|
|
50
52
|
|
|
51
53
|
The catalog is intentionally open to new generic document capabilities, but a
|
|
52
54
|
specific workflow, template, customer, issue, input document, or model
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "tiwater.office-mcp-input/docx_copy_table_rows",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"targetDocument": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"input": { "type": "string", "minLength": 1, "x-tiwater-file-role": "read" },
|
|
10
|
+
"revision": { "type": "string", "pattern": "^docx-rev-v1-[0-9a-f]{64}$" }
|
|
11
|
+
},
|
|
12
|
+
"required": ["input", "revision"],
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
},
|
|
15
|
+
"changes": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"minItems": 1,
|
|
18
|
+
"items": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"targetTableRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
22
|
+
"targetRows": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"firstRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
26
|
+
"lastRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" }
|
|
27
|
+
},
|
|
28
|
+
"required": ["firstRef", "lastRef"],
|
|
29
|
+
"additionalProperties": false
|
|
30
|
+
},
|
|
31
|
+
"sourceDocument": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"input": { "type": "string", "minLength": 1, "x-tiwater-file-role": "read" },
|
|
35
|
+
"revision": { "type": "string", "pattern": "^docx-rev-v1-[0-9a-f]{64}$" }
|
|
36
|
+
},
|
|
37
|
+
"required": ["input", "revision"],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
},
|
|
40
|
+
"sourceTableRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
41
|
+
"sourceRows": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"firstRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
45
|
+
"lastRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
46
|
+
"excludeRefs": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"required": ["firstRef", "lastRef"],
|
|
52
|
+
"additionalProperties": false
|
|
53
|
+
},
|
|
54
|
+
"columns": {
|
|
55
|
+
"type": "array",
|
|
56
|
+
"minItems": 1,
|
|
57
|
+
"items": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"properties": {
|
|
60
|
+
"sourceHeaderRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
61
|
+
"targetHeaderRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
62
|
+
"content": { "type": "string", "enum": ["all-paragraphs", "first-paragraph"] }
|
|
63
|
+
},
|
|
64
|
+
"required": ["sourceHeaderRef", "targetHeaderRef", "content"],
|
|
65
|
+
"additionalProperties": false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": ["targetTableRef", "targetRows", "sourceDocument", "sourceTableRef", "sourceRows", "columns"],
|
|
70
|
+
"additionalProperties": false
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"output": { "type": "string", "minLength": 1, "x-tiwater-file-role": "write" },
|
|
74
|
+
"receiptOutput": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"minLength": 1,
|
|
77
|
+
"x-tiwater-file-role": "write",
|
|
78
|
+
"x-tiwater-file-effect": false
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": ["targetDocument", "changes", "output", "receiptOutput"],
|
|
82
|
+
"additionalProperties": false
|
|
83
|
+
}
|
|
@@ -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.16.
|
|
5
|
+
"version": "0.16.10"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
@@ -38,6 +38,17 @@
|
|
|
38
38
|
"sha256": "5f0bfc826d68f451055aba20390686e0e0df2182797fc36ff285f42d09084104"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
"name": "docx_copy_table_rows",
|
|
43
|
+
"providerContract": {
|
|
44
|
+
"source": "packages/docx-cli/contracts/mcp-input/docx_copy_table_rows.schema.json",
|
|
45
|
+
"sha256": "1698ca119543d17b954ce1cfeaf31f536a98da23cc90c9120cfd3d1d74093706"
|
|
46
|
+
},
|
|
47
|
+
"inputContract": {
|
|
48
|
+
"path": "office/contracts/docx_copy_table_rows.schema.json",
|
|
49
|
+
"sha256": "1698ca119543d17b954ce1cfeaf31f536a98da23cc90c9120cfd3d1d74093706"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
41
52
|
{
|
|
42
53
|
"name": "docx_delete_object",
|
|
43
54
|
"providerContract": {
|
|
@@ -82,17 +93,6 @@
|
|
|
82
93
|
"sha256": "ecf528f83a28f2709efb12182dba18f5f4baf065e8442c76ab568ad01465603d"
|
|
83
94
|
}
|
|
84
95
|
},
|
|
85
|
-
{
|
|
86
|
-
"name": "docx_inspect_tables",
|
|
87
|
-
"providerContract": {
|
|
88
|
-
"source": "packages/docx-cli/contracts/mcp-input/docx_inspect_tables.schema.json",
|
|
89
|
-
"sha256": "f14160d7cff99949dd3e14d60a2d532b31f520bfa72327de972c29c15b9817aa"
|
|
90
|
-
},
|
|
91
|
-
"inputContract": {
|
|
92
|
-
"path": "office/contracts/docx_inspect_tables.schema.json",
|
|
93
|
-
"sha256": "f14160d7cff99949dd3e14d60a2d532b31f520bfa72327de972c29c15b9817aa"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
96
|
{
|
|
97
97
|
"name": "docx_list_objects",
|
|
98
98
|
"providerContract": {
|
package/office/index.mjs
CHANGED
|
@@ -183,14 +183,6 @@ const tools = [
|
|
|
183
183
|
outputSchema: docxInspectionOutput('docx_inspect'),
|
|
184
184
|
handler: docxInspect,
|
|
185
185
|
},
|
|
186
|
-
{
|
|
187
|
-
name: 'docx_inspect_tables',
|
|
188
|
-
description: 'Inspect current DOCX tables. The response returns the revision and a bounded table identity index; the complete table observation remains in the evidence artifact.',
|
|
189
|
-
inputSchema: inputContract('docx_inspect_tables'),
|
|
190
|
-
outputSchema: docxInspectionOutput('docx_inspect_tables'),
|
|
191
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
192
|
-
handler: docxInspectTables,
|
|
193
|
-
},
|
|
194
186
|
{
|
|
195
187
|
name: 'docx_list_objects',
|
|
196
188
|
description: 'List one small page of revision-bound DOCX object identities for structure discovery, not selection by text. To select a table or row by any descendant cell text, call docx_find_literal with kind table or row instead of listing the document. After selecting a table or row, call docx_read_object once to obtain every descendant ref; do not list its rows and cells separately. Use parentRef only when nearest-child paging itself is the requested observation.',
|
|
@@ -220,6 +212,13 @@ const tools = [
|
|
|
220
212
|
outputSchema: fixedEditOutput('docx_copy_content'),
|
|
221
213
|
handler: args => fixedEdit('docx_copy_content', args),
|
|
222
214
|
},
|
|
215
|
+
{
|
|
216
|
+
name: 'docx_copy_table_rows',
|
|
217
|
+
description: 'Create a new DOCX by replacing selected target table row ranges with selected source rows, using explicit source-to-target header cell mappings while retaining target presentation.',
|
|
218
|
+
inputSchema: inputContract('docx_copy_table_rows'),
|
|
219
|
+
outputSchema: fixedEditOutput('docx_copy_table_rows'),
|
|
220
|
+
handler: args => fixedEdit('docx_copy_table_rows', args),
|
|
221
|
+
},
|
|
223
222
|
{
|
|
224
223
|
name: 'docx_copy_object',
|
|
225
224
|
description: 'Create a new output by copying targetDocument and applying one or more selected-object insertions under selected target parent objects.',
|
|
@@ -453,18 +452,6 @@ async function docxInspect(args) {
|
|
|
453
452
|
};
|
|
454
453
|
}
|
|
455
454
|
|
|
456
|
-
async function docxInspectTables(args) {
|
|
457
|
-
const input = path.resolve(requireString(args.input, 'input'));
|
|
458
|
-
const result = await runJsonCandidateChain(docxCandidates, ['inspect-tables', input, '--json']);
|
|
459
|
-
return {
|
|
460
|
-
tool: 'docx_inspect_tables',
|
|
461
|
-
runtime: commandRuntime(result),
|
|
462
|
-
source: await fileArtifact(input),
|
|
463
|
-
artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
|
|
464
|
-
...compactDocxTableIndex(result.json),
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
|
|
468
455
|
async function docxObservation(tool, args) {
|
|
469
456
|
return withTempJsonFile(args, async requestPath => {
|
|
470
457
|
const result = await runJsonCandidateChain(docxCandidates, [tool, requestPath]);
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"input": {
|
|
6
|
-
"type": "string",
|
|
7
|
-
"minLength": 1,
|
|
8
|
-
"x-tiwater-file-role": "read"
|
|
9
|
-
},
|
|
10
|
-
"output": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"minLength": 1,
|
|
13
|
-
"description": "New JSON artifact path. Existing files are never overwritten.",
|
|
14
|
-
"x-tiwater-file-role": "write"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"required": [
|
|
18
|
-
"input",
|
|
19
|
-
"output"
|
|
20
|
-
],
|
|
21
|
-
"additionalProperties": false
|
|
22
|
-
}
|