continue_editing
Modify the most recent image in your session by describing changes, enabling iterative improvements without needing to re-upload the file.
Instructions
Continue editing the LAST image that was generated or edited in this session, optionally using additional reference images. Use this for iterative improvements, modifications, or changes to the most recent image. This automatically uses the previous image without needing a file path.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Text describing the modifications/changes/improvements to make to the last image (e.g., 'change the hat color to red', 'remove the background', 'add flowers') | |
| referenceImages | No | Optional array of file paths to additional reference images to use during editing (e.g., for style transfer, adding elements from other images, etc.) |
Implementation Reference
- src/index.ts:484-518 (handler)The primary handler function for 'continue_editing' tool. Validates configuration and last image existence, then delegates to the 'edit_image' tool using the stored lastImagePath.private async continueEditing(request: CallToolRequest): Promise<CallToolResult> { if (!this.ensureConfigured()) { throw new McpError(ErrorCode.InvalidRequest, "Gemini API token not configured. Use configure_gemini_token first."); } if (!this.lastImagePath) { throw new McpError(ErrorCode.InvalidRequest, "No previous image found. Please generate or edit an image first, then use continue_editing for subsequent edits."); } const { prompt, referenceImages } = request.params.arguments as { prompt: string; referenceImages?: string[]; }; // 检查最后的图片文件是否存在 try { await fs.access(this.lastImagePath); } catch { throw new McpError(ErrorCode.InvalidRequest, `Last image file not found at: ${this.lastImagePath}. Please generate a new image first.`); } // Use editImage logic with lastImagePath return await this.editImage({ method: "tools/call", params: { name: "edit_image", arguments: { imagePath: this.lastImagePath, prompt: prompt, referenceImages: referenceImages } } } as CallToolRequest); }
- src/index.ts:120-139 (schema)Input schema definition for the 'continue_editing' tool, specifying required 'prompt' and optional 'referenceImages'.name: "continue_editing", description: "Continue editing the LAST image that was generated or edited in this session, optionally using additional reference images. Use this for iterative improvements, modifications, or changes to the most recent image. This automatically uses the previous image without needing a file path.", inputSchema: { type: "object", properties: { prompt: { type: "string", description: "Text describing the modifications/changes/improvements to make to the last image (e.g., 'change the hat color to red', 'remove the background', 'add flowers')", }, referenceImages: { type: "array", items: { type: "string" }, description: "Optional array of file paths to additional reference images to use during editing (e.g., for style transfer, adding elements from other images, etc.)", }, }, required: ["prompt"], }, },
- src/index.ts:168-170 (registration)Registration in the tool dispatcher switch statement within the CallToolRequestSchema handler, routing calls to the continueEditing method.case "continue_editing": return await this.continueEditing(request);