Skip to main content
Glama

grok_image_edit

Edit specific regions of a Grok Image 2.0 generation by providing a task_id, an edit prompt, and mask indices from grok_segment_map. Preserves unselected areas and returns a new image for further iterative refinement.

Instructions

Edit ONLY selected regions of a Grok Imagine Image 2.0 generation (4 credits). Pass the source task_id, an edit prompt describing the desired end state of the masked region(s), and mask_indexs — the region indices from grok_segment_map (run it first, free, and pick regions by NAME; do not guess indices). Everything outside the masks is preserved. Returns a new full image; the result task_id can itself be segmented/edited again for iterative refinement at 4 cr per round. Downloads to kie/assets/raw/.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesWhat the masked region(s) should become, plus what to preserve (e.g. "change the background to a sunset beach, keep the apple unchanged")
task_idYesSource task ID — a Grok Image 2.0 generation (or a previous grok_image_edit result)
filenameNoOutput filename. Auto-generated if omitted.
mask_indexsYesRegion indices to edit, from grok_segment_map (e.g. [1] or [0, 2]). Field name matches kie's API spelling.
download_dirNoAbsolute directory to save the file(s) into (created if missing). Defaults to the server's kie/assets/raw/. Must be absolute — the MCP server's working directory is not the caller's.
Install Server

TDQS

A4.4/5.0
Behavior4/5

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

Without annotations, the description carries the burden of transparency. It explains that regions outside the masks are preserved, that a new full image is returned, the cost per round (4 credits), and the download location. This gives a clear picture of the tool's behavior and side effects, though it does not explicitly mention potential failure modes.

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

Conciseness4/5

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

The description is well-structured and covers key points without excessive verbosity. Some phrases are repeated (e.g., mention of task_id and mask_indexs appear twice), but it remains concise and clear.

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

Completeness4/5

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

Given the tool's complexity, the description addresses the essential aspects: purpose, prerequisites, usage steps, output details, and cost. It does not cover error handling or edge cases, but for an editing tool with clear inputs, it is adequately complete.

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

Parameters5/5

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

The schema descriptions already cover each parameter clearly (task_id, prompt, mask_indexs, filename, download_dir). The tool description adds valuable context, such as the need to run grok_segment_map first, the meaning of mask_indexs, and defaults. This fully explains the parameters and their roles.

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 function: editing only selected regions of an image generation, specifying the required inputs (task_id, prompt, mask_indexs) and the intended use case. It also distinguishes itself by referencing the prerequisite grok_segment_map tool.

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?

Provides explicit instructions: run grok_segment_map first, pass the task_id and mask indices, and explains the iterative refinement capability. However, it does not explicitly state when to avoid using this tool or compare it to alternatives, but the guidance is sufficient for the intended usage.

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

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/elibarnett/kie-mcp'

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