Skip to main content
Glama

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
textYes
section_indexNo
folderNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses default behavior, side effect of empty text clearing the first paragraph, return format ({"ok": True}), and three specific error conditions with error codes. This provides comprehensive transparency beyond minimal expectations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured: purpose in first sentence, then default behavior, parameter list, return, and error conditions. Every sentence adds value with no redundancy. At approximately 10 lines, it is appropriately sized and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having no annotations and moderate complexity (4 parameters, 2 required, error handling), the description is fully complete. It covers all aspects: purpose, parameter behavior, return output, and error conditions. The output schema exists and is explained, so no further return details needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning schema provides no descriptions. The description adds meaning for all 4 parameters: explains path (existing .docx), text (new header text, empty string clears), section_index (zero-based, default 0), and folder (optional base folder). This compensates for the missing schema descriptions, though could include format examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool sets a section's header text, with specific verb 'Set the text of a section's header.' It distinguishes from siblings by explaining default behavior (only first section) and how to target other sections via section_index, which differentiates it from similar tools like word_add_footer.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context: default behavior of updating only first section, and explicit instruction to pass section_index for other sections. However, it does not contrast with alternative tools (e.g., when to use word_add_heading instead), so guidelines are good but not exhaustive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gawirable/office-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server