generate
Create images from text descriptions using a text-to-image model. Supports custom dimensions, steps, and seed for reproducible results.
Instructions
Generate an image from a text prompt.
Returns a consistent content array for both stdio and SSE transports:
1. TextContent: Enhanced metadata including generation info and file details
2. ResourceLink: Main image file reference with context-appropriate URI:
- SSE: Absolute URL built from request context (X-Forwarded-* headers), ZIMAGE_BASE_URL, or relative path
- Stdio: file:// URI for local access
3. ImageContent: Thumbnail preview (base64 PNG, max 400px)
URI Building Priority (SSE):
1. Context parameter (ctx.request_context.request) - builds absolute URL from request headers
2. ZIMAGE_BASE_URL environment variable - uses configured base URL
3. Relative URL - fallback when no other method available
File metadata (filename, file_path) is in TextContent to avoid duplication in ResourceLink.
For long-running operations (high steps/large images), this function will:
- Send progress notifications at key milestones via ctx.report_progress()
- Handle client disconnections gracefully
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | ||
| steps | No | Number of inference steps (max bounded by server config) | |
| width | No | Image width in pixels (max bounded by server config) | |
| height | No | Image height in pixels (max bounded by server config) | |
| prompt | Yes | ||
| precision | No | q8 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |