Skip to main content
Glama

continue_editing

Modify the most recent image in your session by describing changes like color adjustments, element additions, or background removal. Supports iterative improvements and optional reference images for style transfer.

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
NameRequiredDescriptionDefault
aspectRatioNoOptional aspect ratio for the edited image. Default is 1:1 (1024×1024).
promptYesText describing the modifications/changes/improvements to make to the last image (e.g., 'change the hat color to red', 'remove the background', 'add flowers')
referenceImagesNoOptional 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

  • The handler function for the 'continue_editing' tool. It checks if an OpenRouter token is configured and if a previous image exists, then delegates to the edit_image logic using the last image path.
    private async continueEditing(request: CallToolRequest): Promise<CallToolResult> {
      if (!this.ensureConfigured()) {
        throw new McpError(ErrorCode.InvalidRequest, "OpenRouter API token not configured. Use configure_openrouter_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, aspectRatio } = request.params.arguments as { 
        prompt: string; 
        referenceImages?: string[];
        aspectRatio?: AspectRatio;
      };
    
      // 检查最后的图片文件是否存在
      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,
            aspectRatio: aspectRatio
          }
        }
      } as CallToolRequest);
    }
  • Input schema for the continue_editing tool, defining parameters like prompt, optional referenceImages, and aspectRatio.
    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.)",
        },
        aspectRatio: {
          type: "string",
          enum: ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"],
          description: "Optional aspect ratio for the edited image. Default is 1:1 (1024×1024).",
        },
      },
      required: ["prompt"],
    },
  • src/index.ts:136-161 (registration)
    Registration of the continue_editing tool in the ListTools response, including name, description, and input schema.
    {
      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.)",
          },
          aspectRatio: {
            type: "string",
            enum: ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"],
            description: "Optional aspect ratio for the edited image. Default is 1:1 (1024×1024).",
          },
        },
        required: ["prompt"],
      },
    },
  • src/index.ts:190-191 (registration)
    Dispatch case in the CallToolRequest handler that routes to the continueEditing method.
    case "continue_editing":
      return await this.continueEditing(request);
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains key behaviors: it operates on the last image in the session automatically and supports iterative editing. However, it doesn't cover important aspects like whether this is a destructive operation (overwrites the last image), authentication needs, rate limits, or what happens if no previous image exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly sized at three sentences, each earning its place. It's front-loaded with the core purpose, followed by usage context, and ending with the automatic behavior. Zero wasted words or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 3 parameters, 100% schema coverage, but no annotations and no output schema, the description is adequate but has gaps. It explains the core purpose and session context well, but doesn't address behavioral aspects like whether this is a read-only or destructive operation, error conditions, or return values. The lack of annotations increases the burden on the description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds minimal value beyond the schema - it mentions 'optionally using additional reference images' which aligns with the referenceImages parameter but doesn't provide additional semantic context. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('continue editing') and identifies the resource ('the LAST image that was generated or edited in this session'). It distinguishes from siblings by specifying it works on the most recent image automatically, unlike 'edit_image' which likely requires explicit file paths.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('for iterative improvements, modifications, or changes to the most recent image') and mentions it automatically uses the previous image. However, it doesn't explicitly state when NOT to use it or name specific alternatives like 'edit_image' for non-last images.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/WeiYu021/openrouter-image-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server