set_aspect_ratio
Configure the aspect ratio for image generation and editing sessions to ensure consistent dimensions across creations. Specify ratios like 16:9 or 1:1 before processing images.
Instructions
Set the aspect ratio for subsequent image generation and editing in this session. Must be called before generating/editing images if a specific ratio is desired.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| aspect_ratio | Yes | The aspect ratio to use for image generation/editing | |
| conversation_id | No | Session ID to apply this setting to (default: 'default') |
Implementation Reference
- src/index.ts:1010-1033 (handler)The implementation of the set_aspect_ratio tool handler, which validates the aspect ratio and updates the context for a given conversation.
case "set_aspect_ratio": { const { aspect_ratio, conversation_id = "default" } = args as any; // Validate aspect ratio if (!VALID_ASPECT_RATIOS.includes(aspect_ratio as AspectRatio)) { return { content: [{ type: "text", text: `Invalid aspect ratio: ${aspect_ratio}. Valid: ${VALID_ASPECT_RATIOS.join(", ")}`, }], isError: true, }; } const context = getOrCreateContext(conversation_id); context.aspectRatio = aspect_ratio as AspectRatio; return { content: [{ type: "text", text: `✓ Aspect ratio set to ${aspect_ratio} for session: ${conversation_id}\nThis will apply to both image generation and editing.`, }], }; } - src/index.ts:422-435 (registration)Registration of the set_aspect_ratio tool, including its description and input schema definition.
name: "set_aspect_ratio", description: "Set the aspect ratio for subsequent image generation and editing in this session. Must be called before generating/editing images if a specific ratio is desired.", inputSchema: { type: "object", properties: { aspect_ratio: { type: "string", enum: [...VALID_ASPECT_RATIOS], description: "The aspect ratio to use for image generation/editing", }, conversation_id: { type: "string", description: "Session ID to apply this setting to (default: 'default')", },