insert_inline_image
Insert an inline image at a specific index in a Google Doc using an HTTPS URL or Drive file ID, with optional width and height. Use document structure to choose the insertion index.
Instructions
Insert an inline image at a specific index in a Google Doc.
Provide either uri (a publicly accessible HTTPS image URL) or drive_file_id (a Drive file ID for an image stored in Drive). The image is inserted at the given document index.
Use get_doc_structure to find a suitable insertion index.
Args: doc_id: The Google Doc file ID. index: Document body index where the image should be inserted. uri: A publicly accessible image URI (HTTPS). Mutually exclusive with drive_file_id. drive_file_id: A Google Drive file ID for an image stored in Drive. The Docs backend fetches the image over HTTP as an anonymous request, so the file must be shared as anyone-with-link (e.g. via share_file with {"type": "anyone", "role": "reader"}) — being accessible to the authenticated user alone is not sufficient and fails with "There was a problem retrieving the image" (confirmed live 2026-07-18). Mutually exclusive with uri. width: Optional image width in points. height: Optional image height in points. auto_downscale: Google Docs rejects any inline image over ~25 megapixels or ~50MB. When drive_file_id is provided and Drive's own reported dimensions or file size exceed either limit, the default (False) fails fast with a clear error naming the limit and the image's actual size — before ever calling the Docs API. Set True to instead resize it and embed the resized copy: the original Drive file is left untouched, a new file named " (resized)" is created alongside it and shared anyone:reader, and its own fileId is returned as resized_file_id. Ignored when uri is used instead of drive_file_id — there's no local copy of a bare uri to resize; an oversized uri source instead fails with a rewritten error explaining the likely cause, since pre-validating or re-hosting arbitrary external content is out of scope here (see docs/decisions/decision- pillow-image-dependency.md).
Returns: Confirmation with docId and the insertion index. Also includes resized_file_id if drive_file_id was resized under auto_downscale, on an error result too, since the resized copy exists either way.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"doc_id": "<doc_id>",
"index": "<index>"
},
"name": "insert_inline_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uri | No | ||
| index | Yes | ||
| width | No | ||
| doc_id | Yes | ||
| height | No | ||
| drive_file_id | No | ||
| auto_downscale | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||