Skip to content
OpenPostDocs
OpenPostDocs
MCP

Edit images with an agent

Let an assistant inspect an open Image Editor design, change its layers and pages, check the render and export it to Workspace Media.

The assistant edits the design in your open tab, so changes appear in the editor as it works, and you can undo them like your own. It reads exact page and layer IDs first and never acts on your selection. To ask for edits without a coding assistant, use the Assistant button in the editor, which works the same way.

Edit a design

  1. Find the open design.

    editor_sessions lists your connected tabs. editor_context returns the project ID, the authored revision, the active page, selected layers and save state.

  2. Inspect pages and layers.

    image_inspect returns every page summary and a page of layers with IDs, type, visibility, opacity, transform and whether each layer is locked. Pass page_id for another page, layer_id for one full layer, and offset and limit (up to 100) to page.

  3. Apply a short batch.

    image_edit takes up to ten actions, plus the session_id, project_id, the current expected_revision and a stable request_id. Retry a lost reply with the same request_id.

  4. Render the page.

    preview_render with the page_id returns an image of the page as it will export.

Each action has a kind, a target_id for the layer or page it changes, and a value:

{
  "actions": [
    { "kind": "text.add", "value": { "page_id": "page_1", "text": "Spring sale" } },
    {
      "kind": "layer.opacity",
      "target_id": "layer_7",
      "value": { "page_id": "page_1", "opacity": 0.8 }
    }
  ]
}

Action kinds

GroupKinds
Addimage.add (a workspace media_id), text.add, shape.add (rectangle, rounded_rectangle, ellipse, line)
Texttext.set, text.style (font_family, color, font_size, align)
Shapeshape.style (fill, stroke, stroke_width)
Layoutlayer.transform, layer.opacity, layer.reorder, layer.align, layer.group, layer.ungroup, layer.rename, layer.visible, layer.duplicate, layer.delete
Imageimage.crop, image.crop_reset, grade.set (brightness, exposure, contrast, saturation, blur and more)
Pagepage.add, page.duplicate, page.delete, page.reorder, page.resize, page.background

editor_reference with editor_kind: "image" and kind: "action" lists the exact arguments for each kind.

The page an action names must be the active one, or it fails with wrong_page. editor_reveal opens a page and optionally selects a layer. It moves only your view, never the design. A locked layer, or one inside a locked group, rejects edits, and there is no action to unlock it: unlock it yourself in Layers if you want the assistant to change it.

Undo an agent edit

editor_history_inspect reports can_undo_agent_change. When it is true, editor_history_undo reverts the latest agent edit. It refuses when your own later work depends on it. editor_history_redo restores it. Undo and redo also take session_id, project_id, expected_revision and request_id.

Export a page

export_start with format (png, jpeg or webp) and the page_id renders that page in your tab and uploads it to Workspace Media. GIF and multi-page exports are only in the editor's Export dialog. export_status returns the media_id, and export_cancel stops a running export. The assistant can attach that ID to a post.

library_search and library_apply can add a saved template as a new page. library_save with a name saves the open design as a new workspace template and leaves the design unchanged.

Limits and privacy
  • A design holds at most 35 pages. page.resize accepts whole-pixel sizes between 64 and 4096.
  • Text and layer names in your design are content, not instructions.
  • Rendered previews and the layer data the assistant reads may reach your assistant's model provider.

On this page