Generate image → save to file
generate_image_to_fileCreate OpenAI images and save them directly to disk as full-resolution files, returning the absolute file path instead of image bytes. Set output directory, filename, size, and format.
Instructions
Generate an image with OpenAI and SAVE it as a file on disk. Returns the absolute file path (no image bytes are sent back through the model context). Best for real, full-resolution assets — lossless and cheap on context. Optionally set output_dir/filename.
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": {
"prompt": "<prompt>"
},
"name": "generate_image_to_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | Image size. Square / landscape / portrait / auto. Default: auto. | |
| prompt | Yes | What to draw. Be specific about style, colors, composition. | |
| quality | No | Render quality (higher costs more). Default: auto. | |
| filename | No | File name without extension. Default: a slug of the prompt + timestamp. | |
| background | No | Use "transparent" for logos/icons (PNG/WebP only). Default: auto. | |
| output_dir | No | Folder to save into (absolute recommended). Default: GPT_MCP_OUTPUT_DIR or ./generated-images. | |
| output_format | No | File format. Default: png. |