word_add_image
Embed an image into a Word document, optionally scaling to a specified width while preserving aspect ratio.
Instructions
Embed an image in the document body.
When width_inches is provided, the image is scaled to that
width and the height is auto-computed from the image's intrinsic
aspect ratio (VAL-WORD-050 / VAL-WORD-078). When omitted,
the image is embedded at its native pixel size.
Args:
path: Path to an existing .docx.
image_path: Path to the image file (PNG / JPEG / GIF / etc.).
width_inches: Optional target width in inches (must be
positive). When None the image is embedded at its
native size.
folder: Optional base folder for the path argument
(does not apply to image_path, which is always
resolved absolutely or relative to the caller's CWD).
Returns:
{"index": <n>} where <n> is the index of the new
inline shape in doc.inline_shapes.
Raises:
OfficeMCPError: ERR_FILE_NOT_FOUND if either path is
missing, ERR_INVALID_PARAMS for an unsupported image
format or a non-positive width_inches,
ERR_UNSUPPORTED_FMT for non-.docx extensions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| image_path | Yes | ||
| width_inches | No | ||
| folder | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||