Skip to main content
Glama
pdf4me
by pdf4me

replace_text_with_image_in_word

Find specific placeholder text in a Word document and replace it with an image. Provide the Word file, image, search text, and page numbers to update the document in place.

Instructions

Replace placeholder text in a Word document with an image using the PDF4me ReplaceTextWithImageInWord API (POST /api/v2/ReplaceTextWithImageInWord). Provide paths to the .docx/.doc file and image, SearchText to find, PageNumbers (e.g. 1 or 1,2), and optional first-page skip. Uses isAsync with 202 Location polling. Saves the modified Word file to disk.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
output_dirNo
search_textYesPlaceholder text in the document to replace (e.g. SIGN_HERE).
page_numbersNoPages to process, as accepted by the API (e.g. "1", "1,2").1
word_file_pathYesLocal path to the Word document (.docx or .doc).
image_file_pathYesLocal path to the replacement image.
output_file_nameNo
is_first_page_skipNoMaps to IsFirstPageSkip.
Behavior3/5

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

With no annotations provided, the description carries the full burden for behavioral disclosure. It does mention 'Uses isAsync with 202 Location polling' and 'Saves the modified Word file to disk', which are useful traits. Yet it omits potential side effects, error handling, or whether the original file is overwritten, leaving some transparency gaps.

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 three sentences and around 50 words. It front-loads the primary action, then lists the key parameters, and touches on async and output behavior. Every sentence adds necessary context with no filler or redundancy.

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?

Given the tool's complexity (7 params, async behavior, no output schema), the description covers the core flow: input files, search text, pages, first-page skip, async polling, and output saving. However, it does not explicitly mention how output_dir/output_file_name control where and what the saved file is named, which is a minor gap for full completeness.

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?

The schema already describes most parameters (71% coverage), and the description adds value by providing an example for PageNumbers ('e.g. 1 or 1,2') and rephrasing 'is_first_page_skip' as 'optional first-page skip'. This helps clarify usage beyond the schema, though it does not compensate for the undocumented output_dir/output_file_name.

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 begins with a specific verb and resource: 'Replace placeholder text in a Word document with an image', clearly distinguishing this from siblings like 'replace_text_with_image' which target other formats. It also names the exact API endpoint, leaving no ambiguity about the operation.

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 clearly establishes the tool's context: it's for Word documents (.docx/.doc), which distinguishes it from PDF-focused siblings. However, it does not explicitly state when not to use it or name alternative tools for scenarios like PDFs, so it stops short of a 5.

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/pdf4me/pdf4me-mcp'

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