@tiwater/office-mcp 0.16.7 → 0.16.8
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/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({
|
|
@@ -437,6 +432,15 @@ function compactDocxTableIndex(report) {
|
|
|
437
432
|
return { revision: report.Revision, tables };
|
|
438
433
|
}
|
|
439
434
|
|
|
435
|
+
function compactDocxObjectIdentity(object) {
|
|
436
|
+
return {
|
|
437
|
+
ref: object.ref,
|
|
438
|
+
parentRef: object.parentRef,
|
|
439
|
+
kind: object.kind,
|
|
440
|
+
textPreview: object.textPreview,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
|
|
440
444
|
async function docxInspect(args) {
|
|
441
445
|
const input = path.resolve(requireString(args.input, 'input'));
|
|
442
446
|
const result = await runJsonCandidateChain(docxCandidates, ['inspect', input, '--json']);
|
|
@@ -480,8 +484,8 @@ async function docxReadObject(args) {
|
|
|
480
484
|
source: await fileArtifact(input),
|
|
481
485
|
artifact: await writeJsonArtifact(output, result.json),
|
|
482
486
|
revision: result.json.receipt.revision,
|
|
483
|
-
object: result.json.observation.object,
|
|
484
|
-
descendants: result.json.observation.descendants,
|
|
487
|
+
object: compactDocxObjectIdentity(result.json.observation.object),
|
|
488
|
+
descendants: result.json.observation.descendants.map(compactDocxObjectIdentity),
|
|
485
489
|
};
|
|
486
490
|
});
|
|
487
491
|
}
|