@tiwater/office-mcp 0.16.7 → 0.16.9
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/tool-runtime.mjs
CHANGED
|
@@ -12,12 +12,9 @@ export function createToolResult(payload, { isError = false } = {}) {
|
|
|
12
12
|
return {
|
|
13
13
|
...(isError ? { isError: true } : {}),
|
|
14
14
|
structuredContent: payload,
|
|
15
|
-
content:
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
text: JSON.stringify(payload, null, 2),
|
|
19
|
-
},
|
|
20
|
-
],
|
|
15
|
+
content: isError
|
|
16
|
+
? [{ type: 'text', text: JSON.stringify(payload) }]
|
|
17
|
+
: [],
|
|
21
18
|
};
|
|
22
19
|
}
|
|
23
20
|
|
package/office/README.md
CHANGED
|
@@ -43,11 +43,6 @@ 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
|
-
`docx_inspect_tables` preserves the v1 body `Tables` view and additively exposes
|
|
47
|
-
header/footer topology in `StoryTables`. Header/footer tables carry part
|
|
48
|
-
coordinates plus section/reference bindings, and only supported direct-story
|
|
49
|
-
tables expose mutation addresses.
|
|
50
|
-
|
|
51
46
|
The catalog is intentionally open to new generic document capabilities, but a
|
|
52
47
|
specific workflow, template, customer, issue, input document, or model
|
|
53
48
|
difference does not justify a new tool. Add a tool only for a stable technical
|
|
@@ -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.9"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
@@ -82,17 +82,6 @@
|
|
|
82
82
|
"sha256": "ecf528f83a28f2709efb12182dba18f5f4baf065e8442c76ab568ad01465603d"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
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
85
|
{
|
|
97
86
|
"name": "docx_list_objects",
|
|
98
87
|
"providerContract": {
|
package/office/index.mjs
CHANGED
|
@@ -166,12 +166,7 @@ const docxObjectIdentity = z.object({
|
|
|
166
166
|
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
167
167
|
parentRef: z.string().regex(/^dox1_[0-9a-f]{64}$/).nullable(),
|
|
168
168
|
kind: z.string(),
|
|
169
|
-
storyPart: z.string(),
|
|
170
|
-
nativePath: z.string(),
|
|
171
|
-
localName: z.string(),
|
|
172
169
|
textPreview: z.string().nullable(),
|
|
173
|
-
textLength: z.number().int().nonnegative().nullable(),
|
|
174
|
-
childCount: z.number().int().nonnegative(),
|
|
175
170
|
}).strict();
|
|
176
171
|
|
|
177
172
|
const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
|
|
@@ -188,14 +183,6 @@ const tools = [
|
|
|
188
183
|
outputSchema: docxInspectionOutput('docx_inspect'),
|
|
189
184
|
handler: docxInspect,
|
|
190
185
|
},
|
|
191
|
-
{
|
|
192
|
-
name: 'docx_inspect_tables',
|
|
193
|
-
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.',
|
|
194
|
-
inputSchema: inputContract('docx_inspect_tables'),
|
|
195
|
-
outputSchema: docxInspectionOutput('docx_inspect_tables'),
|
|
196
|
-
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
197
|
-
handler: docxInspectTables,
|
|
198
|
-
},
|
|
199
186
|
{
|
|
200
187
|
name: 'docx_list_objects',
|
|
201
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.',
|
|
@@ -437,27 +424,24 @@ function compactDocxTableIndex(report) {
|
|
|
437
424
|
return { revision: report.Revision, tables };
|
|
438
425
|
}
|
|
439
426
|
|
|
440
|
-
|
|
441
|
-
const input = path.resolve(requireString(args.input, 'input'));
|
|
442
|
-
const result = await runJsonCandidateChain(docxCandidates, ['inspect', input, '--json']);
|
|
427
|
+
function compactDocxObjectIdentity(object) {
|
|
443
428
|
return {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
...compactDocxTableIndex(result.json.tables),
|
|
429
|
+
ref: object.ref,
|
|
430
|
+
parentRef: object.parentRef,
|
|
431
|
+
kind: object.kind,
|
|
432
|
+
textPreview: object.textPreview,
|
|
449
433
|
};
|
|
450
434
|
}
|
|
451
435
|
|
|
452
|
-
async function
|
|
436
|
+
async function docxInspect(args) {
|
|
453
437
|
const input = path.resolve(requireString(args.input, 'input'));
|
|
454
|
-
const result = await runJsonCandidateChain(docxCandidates, ['inspect
|
|
438
|
+
const result = await runJsonCandidateChain(docxCandidates, ['inspect', input, '--json']);
|
|
455
439
|
return {
|
|
456
|
-
tool: '
|
|
440
|
+
tool: 'docx_inspect',
|
|
457
441
|
runtime: commandRuntime(result),
|
|
458
442
|
source: await fileArtifact(input),
|
|
459
443
|
artifact: await writeJsonArtifact(requireString(args.output, 'output'), result.json),
|
|
460
|
-
...compactDocxTableIndex(result.json),
|
|
444
|
+
...compactDocxTableIndex(result.json.tables),
|
|
461
445
|
};
|
|
462
446
|
}
|
|
463
447
|
|
|
@@ -480,8 +464,8 @@ async function docxReadObject(args) {
|
|
|
480
464
|
source: await fileArtifact(input),
|
|
481
465
|
artifact: await writeJsonArtifact(output, result.json),
|
|
482
466
|
revision: result.json.receipt.revision,
|
|
483
|
-
object: result.json.observation.object,
|
|
484
|
-
descendants: result.json.observation.descendants,
|
|
467
|
+
object: compactDocxObjectIdentity(result.json.observation.object),
|
|
468
|
+
descendants: result.json.observation.descendants.map(compactDocxObjectIdentity),
|
|
485
469
|
};
|
|
486
470
|
});
|
|
487
471
|
}
|
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
|
-
}
|