Skip to main content
Glama
GongRzhe

Office Word MCP Server

add_page_break

Insert a page break in Microsoft Word documents to separate content sections or start new pages where needed.

Instructions

Add a page break to the document.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes

Implementation Reference

  • Core handler function that loads the Word document, adds a page break using python-docx, saves the file, and returns a success or error message.
    async def add_page_break(filename: str) -> str:
        """Add a page break to the document.
        
        Args:
            filename: Path to the Word document
        """
        filename = ensure_docx_extension(filename)
        
        if not os.path.exists(filename):
            return f"Document {filename} does not exist"
        
        # Check if file is writeable
        is_writeable, error_message = check_file_writeable(filename)
        if not is_writeable:
            return f"Cannot modify document: {error_message}. Consider creating a copy first."
        
        try:
            doc = Document(filename)
            doc.add_page_break()
            doc.save(filename)
            return f"Page break added to {filename}."
        except Exception as e:
            return f"Failed to add page break: {str(e)}"
  • MCP tool registration decorator @mcp.tool() with a thin synchronous wrapper that delegates to the async handler in content_tools.
    @mcp.tool()
    def add_page_break(filename: str):
        """Add a page break to the document."""
        return content_tools.add_page_break(filename)
  • Import of the add_page_break function for exposure in the tools package.
    from word_document_server.tools.content_tools import (
        add_heading, add_paragraph, add_table, add_picture,
        add_page_break, add_table_of_contents, delete_paragraph,
        search_and_replace
    )
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states 'Add a page break' which implies a mutation, but doesn't disclose behavioral traits such as whether it modifies the document in-place, requires specific permissions, or has side effects like affecting pagination. This leaves significant gaps in understanding the tool's behavior.

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 a single, efficient sentence that directly states the tool's purpose without any waste. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity of a mutation tool with no annotations, 1 parameter at 0% schema coverage, and no output schema, the description is incomplete. It lacks details on parameters, behavioral context, and expected outcomes, making it inadequate for safe and effective use by an AI agent.

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

Parameters3/5

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

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It doesn't mention the 'filename' parameter at all, failing to add meaning beyond the schema. However, with only one parameter, the baseline is higher, but the description doesn't explain what 'filename' refers to (e.g., document name or path), resulting in a minimal viable score.

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

Purpose4/5

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

The description clearly states the action ('Add') and resource ('page break to the document'), making the purpose evident. However, it doesn't differentiate from siblings like 'add_paragraph' or 'insert_line_or_paragraph_near_text', which could also affect document structure, so it's not fully specific to sibling context.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. With siblings like 'add_paragraph' or 'insert_line_or_paragraph_near_text' that might serve similar formatting purposes, the description lacks context on appropriate scenarios or exclusions, offering minimal usage direction.

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/GongRzhe/Office-Word-MCP-Server'

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