word_add_header
Set or clear the header text of a section in a Word document. Targets the first section by default or a specified section index.
Instructions
Set the text of a section's header.
By default, only the first section's header is updated; later
sections keep their own headers (VAL-WORD-058). Pass an
explicit section_index to target a different section.
Args:
path: Path to an existing .docx.
text: New header text. An empty string clears the first
paragraph (VAL-WORD-057).
section_index: Zero-based section index (default 0).
folder: Optional base folder for relative paths.
Returns:
{"ok": True}.
Raises:
OfficeMCPError: ERR_INVALID_PARAMS for a non-int or
out-of-range section_index or a non-string text,
ERR_FILE_NOT_FOUND if the file is missing,
ERR_UNSUPPORTED_FMT for non-.docx extensions.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"text": "<text>"
},
"name": "word_add_header"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| text | Yes | ||
| section_index | No | ||
| folder | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||