Skip to main content
Glama
rcarmo

office-document-mcp-server

by rcarmo

office_patch

Apply targeted edits to Word, Excel, or PowerPoint documents by specifying cell references, placeholders, or shape paths and new values in a list of changes.

Instructions

Apply edits to Word, Excel, or PowerPoint documents.

Accepts a list of changes and applies them to the document. Each change specifies a target (cell, shape, placeholder, section) and new value.

Replaces: excel_patch_cell, excel_patch_range, excel_replace_placeholders, word_patch_section, word_patch_placeholder, word_fix_split_placeholders, word_replace_global_variables, pptx_patch_shape, pptx_replace_text, pptx_replace_placeholders

Examples: # Patch Excel cells office_patch( file_path="data.xlsx", changes=[ {"target": "B5", "value": "New Value"}, {"target": "C10", "value": 42}, {"target": "D1", "value": "=SUM(A1:A10)"}, ] )

# Patch Excel range (multiple cells at once)
office_patch(
    file_path="data.xlsx",
    changes=[{"target": "A1:B3", "value": [["H1", "H2"], ["A", 1], ["B", 2]]}]
)

# Patch cells on a specific sheet (quote sheet names with special chars)
office_patch(
    file_path="form.xlsm",
    changes=[
        {"target": "'ECIF Work Scope (E)'!B5", "value": "Contoso Ltd"},
        {"target": "'ECIF Work Scope (E)'!B28", "value": "02/01/2026"},
    ]
)

# Replace placeholders in Word
office_patch(
    file_path="template.docx",
    changes=[
        {"target": "<Customer Name>", "value": "Acme Corp"},
        {"target": "<Date>", "value": "2026-01-23"},
    ]
)

# Patch PowerPoint shape
office_patch(
    file_path="deck.pptx",
    changes=[{"target": "slide:1/Title 1", "value": "New Title"}]
)

# Patch PowerPoint with soft return
office_patch(
    file_path="deck.pptx",
    changes=[{"target": "slide:1/Title 2", "value": "Contoso{br}Project"}]
)

IMPORTANT for PowerPoint: When patching content placeholders (body, Content Placeholder), do NOT include bullet characters (•, -, *, etc.) in text lines. PowerPoint placeholders automatically render each line as a bullet. Including bullet characters causes duplication like '- • text'. Use newlines to separate items, and leading spaces (4 spaces) for indentation.

Args: file_path: Path to the document changes: List of changes, each a dict with "target" (cell ref, placeholder, or shape path) and "value" (new content, no bullet chars for PPTX body) track_changes: Log changes for audit trail (default True) output_path: Optional output path (defaults to overwriting input)

Returns: Dictionary with results of all changes. Each successful result includes a "value_preview" field with a truncated preview of the value applied.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the document
changesYesList of changes, each a dict with "target" (cell ref, placeholder, or shape path) and "value" (new content, no bullet chars for PPTX body)
track_changesNoLog changes for audit trail (default True)
output_pathNoOptional output path (defaults to overwriting input)
modeNo
Behavior4/5

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

Annotations indicate mutation (readOnlyHint=false, destructiveHint=false). Description adds context: track_changes default, overwrite behavior, and critical note about PPTX bullets. No contradiction with annotations.

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

Conciseness4/5

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

Well-structured with examples and bolded important note. Slightly lengthy but each section adds value; front-loaded with the core action.

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

Completeness4/5

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

No output schema, but description explains return format. Covers all necessary aspects: file path, changes formatting, track_changes, output_path, and PPTX specific behavior. Complete for a multi-document patching tool.

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 has 80% description coverage. Description adds meaning by explaining target formats across document types (cell refs, placeholders) and the bullet constraint for PPTX. The 'mode' parameter is not mentioned in description, but the overall guidance is valuable.

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 'Apply edits to Word, Excel, or PowerPoint documents.' and lists the tools it replaces (e.g., excel_patch_cell, word_patch_section), making the purpose unambiguous and distinct from sibling tools.

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?

Provides detailed examples for each document type and important notes for PowerPoint. Lacks explicit when-not-to-use or alternative suggestions, but the coverage of use cases is thorough.

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/rcarmo/python-office-mcp-server'

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