Skip to main content
Glama

edit_image

Edit images with xAI's Grok model using ordered URLs, data URIs, local paths, or Files API IDs. Supply up to 5 sources and control aspect ratio, resolution, and output count.

Instructions

Edit images with xAI using ordered URLs, data URIs, local paths, or Files API IDs. Supports up to 3 source images with 1.0 or 5 with 2.0. URLs are temporary unless persisted.

Input Schema

NameRequiredDescriptionDefault
nNoNumber of output images (default: 1)
modelNoOverrides XAI_IMAGE_MODEL (default: grok-imagine-image). Choose grok-imagine-image-2.0 for quality control and up to 5 inputs
imagesNoOrdered sources as {url: URL, data URI, or local path} or {file_id: Files API ID}. Supply either images or image_urls
promptYesDescribe the image to generate or the desired edits
qualityNoImage 2.0 only. Auto uses low for generation and medium for editing; billing follows the served quality
image_urlsNoSource URLs, base64 data URIs, or local paths, in order. Supply either image_urls or images. 1.0 allows 3; 2.0 allows 5
resolutionNoOutput resolution (default: 1k)
aspect_ratioNoGeneration defaults to auto; editing follows the first input. 21:9 and 5:2 require image 2.0
response_formatNourl returns temporary links (default); b64_json returns MCP image content
storage_optionsNoPersist outputs in the Files API; private unless public_url is explicitly enabled

Output Schema

NameRequiredDescriptionDefault
modelNo
usageNo
imagesYes
qualityNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed18 schema fields changedv1.1.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / aspect_ratio / description
      Previous value: -"Override the output aspect ratio (default: follows first input image)"New value: +"Generation defaults to auto; editing follows the first input. 21:9 and 5:2 require image 2.0"
    • changedInput schema / properties / aspect_ratio / enum
      Previous value: -[
      -  "1:1",
      -  "16:9",
      -  "9:16",
      -  "4:3",
      -  "3:4",
      -  "3:2",
      -  "2:3",
      -  "2:1",
      -  "1:2",
      -  "19.5:9",
      -  "9:19.5",
      -  "20:9",
      -  "9:20",
      -  "auto"
      -]New value: +[
      +  "1:1",
      +  "16:9",
      +  "9:16",
      +  "4:3",
      +  "3:4",
      +  "3:2",
      +  "2:3",
      +  "2:1",
      +  "1:2",
      +  "19.5:9",
      +  "9:19.5",
      +  "20:9",
      +  "9:20",
      +  "21:9",
      +  "5:2",
      +  "auto"
      +]
    • changedInput schema / properties / image_urls / description
      Previous value: -"Array of source image URLs, base64 data URIs, or local file paths (1-3 images)"New value: +"Source URLs, base64 data URIs, or local paths, in order. Supply either image_urls or images. 1.0 allows 3; 2.0 allows 5"
    • addedInput schema / properties / image_urls / items / minLength
      Added value: +1
    • changedInput schema / properties / image_urls / maxItems
      Previous value: -3New value: +5
    • addedInput schema / properties / images
      Added value: +{
      +  "description": "Ordered sources as {url: URL, data URI, or local path} or {file_id: Files API ID}. Supply either images or image_urls",
      +  "items": {
      +    "anyOf": [
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "url": {
      +            "minLength": 1,
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "url"
      +        ],
      +        "type": "object"
      +      },
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "file_id": {
      +            "minLength": 1,
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "file_id"
      +        ],
      +        "type": "object"
      +      }
      +    ]
      +  },
      +  "maxItems": 5,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • addedInput schema / properties / model
      Added value: +{
      +  "description": "Overrides XAI_IMAGE_MODEL (default: grok-imagine-image). Choose grok-imagine-image-2.0 for quality control and up to 5 inputs",
      +  "enum": [
      +    "grok-imagine-image",
      +    "grok-imagine-image-2.0"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / n / description
      Previous value: -"Number of images to generate (1-10, default 1)"New value: +"Number of output images (default: 1)"
    • changedInput schema / properties / prompt / description
      Previous value: -"Text description of the desired edits"New value: +"Describe the image to generate or the desired edits"
    • addedInput schema / properties / prompt / minLength
      Added value: +1
    • addedInput schema / properties / quality
      Added value: +{
      +  "description": "Image 2.0 only. Auto uses low for generation and medium for editing; billing follows the served quality",
      +  "enum": [
      +    "low",
      +    "medium",
      +    "auto"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / resolution / description
      Previous value: -"Resolution of the output image (default: 1k)"New value: +"Output resolution (default: 1k)"
    • addedInput schema / properties / response_format
      Added value: +{
      +  "description": "url returns temporary links (default); b64_json returns MCP image content",
      +  "enum": [
      +    "url",
      +    "b64_json"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / storage_options
      Added value: +{
      +  "description": "Persist outputs in the Files API; private unless public_url is explicitly enabled",
      +  "properties": {
      +    "expires_after": {
      +      "description": "File lifetime in seconds; omitted means permanent storage",
      +      "maximum": 2592000,
      +      "minimum": 3600,
      +      "type": "integer"
      +    },
      +    "filename": {
      +      "description": "Filename for the stored image, e.g. landscape.jpg",
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "public_url": {
      +      "anyOf": [
      +        {
      +          "type": "boolean"
      +        },
      +        {
      +          "properties": {
      +            "expires_after": {
      +              "maximum": 2592000,
      +              "minimum": 3600,
      +              "type": "integer"
      +            }
      +          },
      +          "type": "object"
      +        }
      +      ],
      +      "description": "Explicitly create a public link; omitted means private storage"
      +    }
      +  },
      +  "required": [
      +    "filename"
      +  ],
      +  "type": "object"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "prompt",
      -  "image_urls"
      -]New value: +[
      +  "prompt"
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "images": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "file_output": {
      +            "anyOf": [
      +              {
      +                "additionalProperties": false,
      +                "properties": {
      +                  "expires_at": {
      +                    "type": "number"
      +                  },
      +                  "file_id": {
      +                    "minLength": 1,
      +                    "type": "string"
      +                  },
      +                  "filename": {
      +                    "type": "string"
      +                  },
      +                  "public_url": {
      +                    "type": "string"
      +                  },
      +                  "public_url_error": {
      +                    "type": "string"
      +                  },
      +                  "public_url_expires_at": {
      +                    "type": "number"
      +                  }
      +                },
      +                "required": [
      +                  "file_id"
      +                ],
      +                "type": "object"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ]
      +          },
      +          "inline": {
      +            "description": "Image bytes are in the corresponding MCP image content block",
      +            "type": "boolean"
      +          },
      +          "mime_type": {
      +            "anyOf": [
      +              {
      +                "minLength": 1,
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ]
      +          },
      +          "respect_moderation": {
      +            "type": "boolean"
      +          },
      +          "revised_prompt": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "url": {
      +            "anyOf": [
      +              {
      +                "minLength": 1,
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ]
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "minItems": 1,
      +      "type": "array"
      +    },
      +    "model": {
      +      "type": "string"
      +    },
      +    "quality": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "usage": {
      +      "additionalProperties": {},
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "images"
      +  ],
      +  "type": "object"
      +}
  2. First observedv1.0.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already disclose that this is a non-read-only, non-idempotent, open-world, non-destructive operation. The description adds genuinely useful behavior beyond that: input-count limits tied to model version (3 for 1.0, 5 for 2.0) and the fact that returned URLs are temporary unless persisted via storage_options.

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?

Two dense sentences with no filler, and the input-source forms and limits are front-loaded. It could be tightened slightly, but every clause carries usable information.

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?

With an output schema present and 100% schema coverage, the description need not explain return values. It covers the key operational constraints (input count per model, temporary URLs). It omits any note on persistence behavior details or quality/response_format interplay, but those are schema-documented.

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 every parameter is already documented in the schema, including the image_urls vs images alternatives and model-dependent input caps. The description restates the accepted input forms but adds no format or syntax detail beyond the schema, so the baseline 3 applies.

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

Purpose4/5

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

States a specific verb (edit) and resource (images), plus the provider (xAI). It implicitly contrasts with the sibling generate_image, but never names or distinguishes it explicitly, so an agent must infer the generate-vs-edit boundary.

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

Usage Guidelines3/5

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

Usage is implied by 'Edit images' and the mention of source inputs, which suggests this is for modifying existing images rather than creating new ones. However, there is no explicit when-to-use, when-not-to-use, or routing to generate_image, so the agent must infer the choice.

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

Deploy Server

Other Tools