Generate an image inside an ebook
generate_content_imageGenerate one image with AI and place it INSIDE one of the caller's ebooks, either filling an existing image placeholder (blockId) or inserting a new image after a block (afterBlockId). With no prompt the subject is taken from the heading and paragraph around that spot, so writing the content first produces images that fit it. Choose WHERE an image belongs; Unplain decides its shape and how large it is drawn from the space on its page, so there is no size to set. WHEN TO USE IT: generate an image where it materially improves comprehension or visual rhythm, for example to show a physical thing, explain a process, set atmosphere at the start of a part, or break up a long dense stretch. Do NOT put one after every section; an ebook reads as edited when its images are chosen, and as padding when they are automatic. A twenty page guide usually wants a handful, not twenty. NEVER use an image to present data. An image model invents the numbers as well as the bars, which produces a plausible fabricated statistic inside a document a reader will trust. For a statistical passage choose a conceptual or diagram style that carries the idea without figures. To explain a process, comparison or set of relationships choose the infographic style: it draws one structure from the surrounding section, wordless, so put its words in the caption. The artwork is always wordless: the no-text rule cannot be lifted by a prompt, and captions are real text set by Unplain, passed as the caption argument. This spends the SAME shared AI image allowance as generating a cover or generating one in the Unplain web app (get_account reports it); MCP has no separate allowance, and every plan has one (Free includes a few lifetime images). One image per call, a failed generation costs nothing, and the image is attached to the ebook rather than returned.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alt | No | Alt text for accessibility. Worth setting on every image. | |
| style | No | Medium and mood. LEAVE IT UNSET when the ebook already has generated images: the new one is then matched to the first one automatically, using it as a visual reference, which is how a set of images ends up looking like one publication. Naming a style overrides that and is the right call only when you deliberately want this image to differ. Pick 'diagram' for a schematic, 'infographic' to explain a process, comparison, hierarchy or set of relationships from the surrounding section as one editorial figure, and 'conceptual' for an idea rather than a thing. An infographic is drawn WORDLESS (the model writes labels and figures unreliably, so none are drawn): pass the words that go with it as the caption, and let the section text supply the content. Do NOT use an image to present data: charts are drawn with invented numbers and are never acceptable in a document a reader will trust. | |
| prompt | No | What the image should show, as imagery: subject, setting, mood. Omit it and the subject is derived from the heading and paragraph around the insertion point, which is usually enough. The image is generated with a hard no-text rule that no prompt can lift, so do not ask for labels, captions or any writing in the picture. | |
| blockId | No | Fill an image placeholder that already exists, keeping its position, caption and alignment. Use read_ebook to find placeholders that have no image yet. Give either this or afterBlockId, never both. | |
| caption | No | Caption printed under the image. Also the strongest steer on what to generate, since it states what the picture is meant to show. | |
| projectId | Yes | ||
| afterBlockId | No | Insert a new image directly after this block. Use the id of the paragraph the image should follow; given an image, the new one goes after that image's caption. Give either this or blockId, never both. | |
| replaceExisting | No | Required to overwrite an image the block already has. Left false, a call against a filled block fails without spending an AI image allowance, which makes an accidental retry safe. |