generate_image
Generate an AI image from a prompt and apply it as a fill to an existing canvas element; create the target element first, then pass its ID.
Instructions
Generate an AI image and apply it as a fill on targetElementId. Target element must already exist — create it first (top-level hosted-CLI agents: emit an <edit> block; sub-agents and external MCP clients: call edit), then call generate_image with that element's id or #ref. Call get_knowledge(["images/prompts","images/integration","images/references"]) for prompt engineering, quality presets, and parallel-generation guidance. Runs on your own Google key when one is set (Settings > Your own AI > Google), otherwise on Brilliant AI for a signed-in account.
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": {
"canvasId": "<canvasId>"
},
"name": "generate_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | No | Natural-language paragraph describing the image. | |
| targets | No | Batch mode: generate multiple images in parallel (preferred when generating 2+). | |
| canvasId | Yes | Canvas ID. Required. | |
| imageSize | No | "1K" (default) | "2K" | "4K". | |
| sessionId | No | Session ID for per-session visual feedback. Optional. | |
| aspectRatio | No | Output aspect ratio: "1:1" (default) | "16:9" | "9:16" | "4:3" | "3:4". In batch mode applies to every target unless a target overrides it. | |
| targetElementId | No | Element ID to apply the image fill to. Required unless targets is provided. | |
| referenceElementIds | No | Element IDs to use as reference images (up to 14). |