@tiwater/office-mcp 0.16.17 → 0.16.19
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/index.mjs
CHANGED
|
@@ -170,15 +170,9 @@ const docxObjectIdentity = z.object({
|
|
|
170
170
|
verticalMerge: z.string().nullable(),
|
|
171
171
|
}).strict();
|
|
172
172
|
|
|
173
|
-
const docxObjectNode = z.lazy(() => z.object({
|
|
174
|
-
object: docxObjectIdentity,
|
|
175
|
-
children: z.array(docxObjectNode),
|
|
176
|
-
}).strict());
|
|
177
|
-
|
|
178
173
|
const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
|
|
179
174
|
revision: docxRevision,
|
|
180
175
|
object: docxObjectIdentity,
|
|
181
|
-
children: z.array(docxObjectNode),
|
|
182
176
|
}).strict();
|
|
183
177
|
|
|
184
178
|
const tools = [
|
|
@@ -206,7 +200,7 @@ const tools = [
|
|
|
206
200
|
},
|
|
207
201
|
{
|
|
208
202
|
name: 'docx_read_object',
|
|
209
|
-
description: 'Read one selected native DOCX object as an ordered native hierarchy. For a table, request row and cell kinds once; each row contains its ordered cells with text, grid span, and vertical merge state. Also request paragraph when paragraph boundaries determine what a later copy operation must retain.',
|
|
203
|
+
description: 'Read one selected native DOCX object as an ordered native hierarchy written to the requested output artifact. The tool response only identifies that artifact and the selected root object; read the artifact for descendant refs and content. For a table, request row and cell kinds once; each row contains its ordered cells with text, grid span, and vertical merge state. Also request paragraph when paragraph boundaries determine what a later copy operation must retain.',
|
|
210
204
|
inputSchema: inputContract('docx_read_object'),
|
|
211
205
|
outputSchema: docxReadObjectOutput,
|
|
212
206
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -266,6 +260,7 @@ const tools = [
|
|
|
266
260
|
description: 'Write a body-only DOCX JSON projection only when a downstream consumer explicitly requires that format. It is not a companion to docx_inspect and does not replace bounded list/find/read object selection.',
|
|
267
261
|
inputSchema: inputContract('docx_export_json'),
|
|
268
262
|
outputSchema: artifactOutput('docx_export_json'),
|
|
263
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
269
264
|
handler: docxExportJson,
|
|
270
265
|
},
|
|
271
266
|
{
|
|
@@ -319,6 +314,7 @@ const tools = [
|
|
|
319
314
|
description: 'Inspect a current XLSX workbook or legacy XLS workbook and write one JSON observation containing workbook structure, exported values, formulas, styles, merged ranges, and any published legacy-format conversion evidence.',
|
|
320
315
|
inputSchema: inputContract('xlsx_inspect'),
|
|
321
316
|
outputSchema: artifactOutput('xlsx_inspect'),
|
|
317
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
322
318
|
handler: xlsxInspect,
|
|
323
319
|
},
|
|
324
320
|
{
|
|
@@ -326,6 +322,7 @@ const tools = [
|
|
|
326
322
|
description: 'Export workbook sheet data from XLSX as structured JSON.',
|
|
327
323
|
inputSchema: inputContract('xlsx_export_json'),
|
|
328
324
|
outputSchema: artifactOutput('xlsx_export_json'),
|
|
325
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
329
326
|
handler: xlsxExportJson,
|
|
330
327
|
},
|
|
331
328
|
...fixedToolDefinitions(xlsxFixedTools),
|
|
@@ -341,6 +338,7 @@ const tools = [
|
|
|
341
338
|
description: 'Inspect a PPTX file and write one detailed JSON observation containing slides, masters, layouts, shapes, transforms, paragraphs, runs, and placeholders.',
|
|
342
339
|
inputSchema: inputContract('pptx_inspect'),
|
|
343
340
|
outputSchema: artifactOutput('pptx_inspect'),
|
|
341
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
344
342
|
handler: pptxInspect,
|
|
345
343
|
},
|
|
346
344
|
{
|
|
@@ -348,6 +346,7 @@ const tools = [
|
|
|
348
346
|
description: 'Export PPTX slide text, notes, and placeholder hints to a new JSON artifact without returning the full presentation through MCP.',
|
|
349
347
|
inputSchema: inputContract('pptx_export_json'),
|
|
350
348
|
outputSchema: artifactOutput('pptx_export_json'),
|
|
349
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
351
350
|
handler: pptxExportJson,
|
|
352
351
|
},
|
|
353
352
|
{
|
|
@@ -462,18 +461,10 @@ async function docxReadObject(args) {
|
|
|
462
461
|
artifact: await writeJsonArtifact(output, result.json),
|
|
463
462
|
revision: result.json.receipt.revision,
|
|
464
463
|
object: compactDocxObjectIdentity(result.json.observation.object),
|
|
465
|
-
children: result.json.observation.children.map(compactDocxObjectNode),
|
|
466
464
|
};
|
|
467
465
|
});
|
|
468
466
|
}
|
|
469
467
|
|
|
470
|
-
function compactDocxObjectNode(node) {
|
|
471
|
-
return {
|
|
472
|
-
object: compactDocxObjectIdentity(node.object),
|
|
473
|
-
children: node.children.map(compactDocxObjectNode),
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
|
|
477
468
|
async function docxValidate(args) {
|
|
478
469
|
const result = await runJsonCandidateChain(docxCandidates, ['validate-openxml', requireString(args.input, 'input')], { allowedExitCodes: [0, 1] });
|
|
479
470
|
return { tool: 'docx_validate', runtime: commandRuntime(result), result: result.json };
|