@tiwater/office-mcp 0.14.2 → 0.14.3
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 +1 -1
- package/office/index.mjs +17 -0
- package/package.json +1 -1
package/office/README.md
CHANGED
|
@@ -8,7 +8,7 @@ template-migration workflow, customer mapping, or Lucid lifecycle.
|
|
|
8
8
|
|
|
9
9
|
## Capability families
|
|
10
10
|
|
|
11
|
-
- DOCX: inspect document/tables, export, compare, validate OpenXML and
|
|
11
|
+
- DOCX: inspect document/tables, export, compare, validate OpenXML, font, and table-of-contents styles
|
|
12
12
|
policy, fill placeholders, transform styles, and batch one fixed edit action.
|
|
13
13
|
- XLS/XLSX: convert legacy XLS with ET, inspect/export/fill, validate, and batch
|
|
14
14
|
one fixed workbook edit action.
|
package/office/index.mjs
CHANGED
|
@@ -191,6 +191,8 @@ const richTextSegment = z.object({
|
|
|
191
191
|
underline: z.boolean().optional(),
|
|
192
192
|
bold: z.boolean().optional(),
|
|
193
193
|
fontName: z.string().optional(),
|
|
194
|
+
italic: z.boolean().optional(),
|
|
195
|
+
verticalAlignment: z.enum(['baseline', 'superscript', 'subscript']).optional(),
|
|
194
196
|
}).strict();
|
|
195
197
|
const tableCellInput = z.object({
|
|
196
198
|
text: z.string().optional(),
|
|
@@ -261,6 +263,7 @@ const docxEditActions = [
|
|
|
261
263
|
editAction('docx_set_table_row_keep_next', 'setTableRowKeepNext', 'Set keep-next behavior for current body table rows.', z.object({ tableIndex: index, rowIndex: index, keepNext: z.boolean() }).strict()),
|
|
262
264
|
editAction('docx_set_body_paragraph_keep_next', 'setBodyParagraphKeepNext', 'Set keep-next behavior for current body paragraphs.', z.object({ paragraphIndex: index, keepNext: z.boolean() }).strict()),
|
|
263
265
|
editAction('docx_set_body_paragraph_keep_lines', 'setBodyParagraphKeepLines', 'Set keep-lines behavior for current body paragraphs.', z.object({ paragraphIndex: index, keepLines: z.boolean() }).strict()),
|
|
266
|
+
editAction('docx_apply_toc_style_policy', 'applyTocStylePolicy', 'Apply current document table-of-contents paragraph style properties.', z.object({ italic: z.boolean(), indentCharactersPerLevel: index }).strict()),
|
|
264
267
|
editAction('docx_set_header_paragraph_font_size', 'setHeaderParagraphFontSize', 'Set current header paragraph font size.', z.object({ headerIndex: index, paragraphIndex: index, fontSize: pathInput }).strict()),
|
|
265
268
|
documentAction('docx_collapse_trailing_empty_section', 'collapseTrailingEmptySection', 'Collapse a current trailing empty section.'),
|
|
266
269
|
documentAction('docx_collapse_trailing_empty_paragraphs', 'collapseTrailingEmptyBodyParagraphs', 'Collapse current trailing empty body paragraphs.'),
|
|
@@ -360,6 +363,13 @@ const tools = [
|
|
|
360
363
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
361
364
|
handler: docxValidateFontPolicy,
|
|
362
365
|
},
|
|
366
|
+
{
|
|
367
|
+
name: 'docx_validate_toc_style_policy',
|
|
368
|
+
description: 'Validate current DOCX table-of-contents paragraph styles against an explicit policy.',
|
|
369
|
+
inputSchema: z.object({ input: pathInput, italic: z.boolean(), indentCharactersPerLevel: index }).strict(),
|
|
370
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
371
|
+
handler: docxValidateTocStylePolicy,
|
|
372
|
+
},
|
|
363
373
|
{
|
|
364
374
|
name: 'docx_strip_direct_formatting',
|
|
365
375
|
description: 'Remove direct paragraph and run formatting while preserving styles.',
|
|
@@ -556,6 +566,13 @@ async function docxValidateFontPolicy(args) {
|
|
|
556
566
|
});
|
|
557
567
|
}
|
|
558
568
|
|
|
569
|
+
async function docxValidateTocStylePolicy(args) {
|
|
570
|
+
const result = await runJsonCandidateChain(docxCandidates, [
|
|
571
|
+
'validate-toc-style-policy', requireString(args.input, 'input'), String(args.italic), String(args.indentCharactersPerLevel),
|
|
572
|
+
], { allowedExitCodes: [0, 1] });
|
|
573
|
+
return { tool: 'docx_validate_toc_style_policy', runtime: commandRuntime(result), result: result.json };
|
|
574
|
+
}
|
|
575
|
+
|
|
559
576
|
async function docxStripDirectFormatting(args) {
|
|
560
577
|
return copyTransform('docx_strip_direct_formatting', docxCandidates, ['strip-direct-formatting'], args);
|
|
561
578
|
}
|