GIMP

v0.7.0
io.github.mhbxyz/gimp-mcp Checked 2 days ago Published 22 days ago

Inspect and edit images in a running GIMP 3.2+ (layers, text, filters, files) from any MCP client.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

gimp_status GIMP status

Diagnose the connection to the running GIMP session: GIMP version, session id and the list of open images (with their ids). Call this first.

gimp_list_toolsets List toolsets

List the groups of GIMP tools (toolsets), what each contains and which are enabled. Tools of disabled toolsets are not in your tool list: enable them with gimp_enable_toolsets.

gimp_enable_toolsets Enable toolsets

Add the tools of one or more toolsets (see gimp_list_toolsets) to your tool list for this session. The result gives each added tool's signature (usage): call them with those arguments. The server notifies the client that its tool list changed; a client that does not refresh its tool list needs a restart with the toolsets in --toolsets or GIMP_MCP_TOOLSETS. Images and their undo history are untouched.

ParameterTypeDescription
toolsets *arrayToolset names.

gimp_inspect_image Inspect image

Describe one image: size, mode, precision, resolution, unsaved changes, associated files and the full ordered layer tree (groups, children, masks, offsets, opacity, blend mode, locks). Does not depend on GIMP's active selection.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.

gimp_inspect_item Inspect item

Describe one item by id: kind (layer, group, text, mask, channel, path), owning image, parent and position, and its layer properties. Fails with NOT_FOUND once the item is deleted.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.

gimp_preview Preview image

Render the composite of an image (all visible layers, with transparency) as a PNG whose longest side is at most max_size pixels (16-1024, default 512 or $GIMP_MCP_PREVIEW_MAX_SIZE). Proportions are kept and the image is never upscaled. Does not modify the document, its undo history or its saved state.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
max_sizeLongest side of the preview.

gimp_create_image Create image

Create a new image with a single layer named layer_name filled with an explicit color (default white; 'transparent' gives an alpha layer). Like a new image in GIMP's UI, it starts without unsaved changes and without undo history. Shown in a window when GIMP has a UI.

ParameterTypeDescription
height *integerPixels.
width *integerPixels.
base_typestring
fillstringsRGB color as '#rrggbb', '#rrggbbaa', '#rgb' or one of: white, black, red, green, blue, transparent
layer_namestring
resolutionPixels per inch.

gimp_open_image Open image

Open a local file (XCF or any format GIMP can load: PNG, JPEG, WebP, TIFF...) as a new image. The path must be absolute (~ allowed). PDF pages, SVG size, RAW: gimp_open_with_options (toolset formats). A new image: nothing in an undo history changes.

ParameterTypeDescription
path *stringAbsolute path of the file to open.

gimp_save_image Save project (XCF)

Save the image as a GIMP project (.xcf), keeping layers, groups, masks and text. Without path, saves to the image's current XCF file (a normal 'Save'). With a path, an existing file is only replaced when overwrite=true. Marks the image as having no unsaved changes. Writing the file is not in GIMP's undo history.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
overwriteboolean
pathAbsolute .xcf path; default: current XCF file.

gimp_export_image Export PNG/JPEG

Export the visible composite of the image to PNG or JPEG (format from the extension). The image itself is not modified. Existing files are only replaced when overwrite=true. Defaults: PNG compression 9, not interlaced; JPEG quality 90, baseline, optimized, transparency flattened on white. WebP, AVIF, TIFF, PDF…: gimp_export_as (toolset formats). The undo history is unchanged.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
path *stringAbsolute path ending in .png, .jpg or .jpeg.
format
jpeg_options
overwriteboolean
png_options

gimp_close_image Close image

Close an image. Refused with UNSAVED_CHANGES when it has unsaved changes, unless discard_changes=true. Its id (and its items' ids) become invalid. Not undoable: the image and its undo history are gone.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
discard_changesboolean

gimp_create_layer Create layer

Add a new raster layer (with alpha) to an image, at an explicit parent and position. Size and offset are in image pixels (default: the image size at 0,0). fill: 'transparent' or a color. One undo step.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
name *string
fillstringsRGB color as '#rrggbb', '#rrggbbaa', '#rgb' or one of: white, black, red, green, blue, transparent
height
modestringGIMP layer mode nick, e.g. normal, multiply, screen, overlay, soft-light, hard-light, addition, subtract, difference, darken-only, lighten-only, hue, saturation, color, dodge, burn, pass-through (grou…
opacitynumber0 (transparent) - 100 (opaque).
parentGroup id to put the layer in; null for the top level of the image.
positionintegerIndex within the parent, 0 = top-most (in front).
visibleboolean
width
xinteger
yinteger

gimp_create_group Create layer group

Add an empty layer group at an explicit parent and position. One undo step.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
name *string
parentGroup id to put the layer in; null for the top level of the image.
positionintegerIndex within the parent, 0 = top-most (in front).

gimp_import_layer Import file as layer

Load an image file (PNG, JPEG, XCF... absolute path) as a new layer of an existing image. Multi-layer files are flattened into one layer. Placed at x,y (default 0,0); name defaults to the file name. One undo step.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
path *stringAbsolute path of the file to import.
name
parentGroup id to put the layer in; null for the top level of the image.
positionintegerIndex within the parent, 0 = top-most (in front).
xinteger
yinteger

gimp_duplicate_layer Duplicate layer

Copy a layer or a whole group (with masks and children). By default the copy is placed just above the original in the same parent. GIMP names it '<name> copy'. One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
parentGroup id to put the layer in; null for the top level of the image.
position

gimp_set_layer_properties Set layer properties

Rename a layer or group and/or change its visibility, opacity (0-100), blend mode or locks (content, position, visibility, alpha). Only the given properties change. Not destructive: pixels are untouched. One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
lock_alpha
lock_content
lock_position
lock_visibility
modeGIMP layer mode nick, e.g. normal, multiply, screen, overlay, soft-light, hard-light, addition, subtract, difference, darken-only, lighten-only, hue, saturation, color, dodge, burn, pass-through (grou…
name
opacity
visible

gimp_move_layer Move layer in the stack

Move a layer or group to another parent (a group of the same image, or null for the top level) and position (0 = top-most). Does not change pixels or offsets. One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
parent *Group id to put the layer in; null for the top level of the image.
position *integerIndex within the parent, 0 = top-most (in front).

gimp_delete_layer Delete layer

Remove a layer or a group with all its children. Destructive: the pixels are lost unless undone in GIMP or the image is reverted from a saved file. Ids of removed items become invalid.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.

gimp_resize_image Scale image

Scale the whole image and every layer to width x height pixels (layer sizes and offsets scale proportionally). Give only width or only height to keep the aspect ratio. Lossy: pixels are resampled with the given interpolation. One undo step.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
heightPixels; omit one of width/height to keep the aspect ratio.
interpolationstringResampling: none (nearest neighbour, hard edges), linear, cubic, nohalo, lohalo.
widthPixels; omit one of width/height to keep the aspect ratio.

gimp_resize_canvas Resize canvas

Change the canvas size without resampling. Layers move by (offset_x, offset_y) and keep their size, unless resize_layers is 'all' or 'image-sized' (layers that covered the old canvas): those grow or shrink to the canvas, new areas transparent or fill_color. One undo step.

ParameterTypeDescription
height *integerPixels.
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
width *integerPixels.
fill_colorFill new layer areas (default: transparent).
offset_xinteger
offset_yinteger
resize_layersstring

gimp_crop_image Crop image

Crop the image to the rectangle (x, y, width, height) in image pixels, which must lie inside the canvas. Destructive: layer pixels outside the rectangle are discarded. One undo step.

ParameterTypeDescription
height *integerPixels.
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
width *integerPixels.
x *integer
y *integer

gimp_set_layer_offsets Move layer (offsets)

Place a layer or group so its top-left corner is at (x, y) in image pixels (may be negative or outside the canvas). Lossless. Refused with LOCKED when its position is locked. One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
x *integer
y *integer

gimp_scale_layer Scale layer

Resample a layer or group to width x height pixels; give only width or only height to keep its aspect ratio. anchor='center' keeps its center, 'top-left' keeps its top-left corner. Lossy. One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
anchorstring
heightPixels; omit one of width/height to keep the aspect ratio.
interpolationstringResampling: none (nearest neighbour, hard edges), linear, cubic, nohalo, lohalo.
widthPixels; omit one of width/height to keep the aspect ratio.

gimp_rotate_layer Rotate layer

Rotate a layer or group by angle degrees (clockwise) around its center. clip='adjust' grows the layer to keep all pixels, 'clip' keeps the original bounds. Multiples of 90 are lossless with interpolation 'none'; other angles resample. One undo step. Perspective, shear: gimp_transform (toolset geometry).

ParameterTypeDescription
angle *numberDegrees, clockwise.
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
clipstring
interpolationstringResampling: none (nearest neighbour, hard edges), linear, cubic, nohalo, lohalo.

gimp_flip_layer Flip layer

Mirror a layer or group horizontally or vertically around its center. Lossless. One undo step.

ParameterTypeDescription
direction *string
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.

gimp_select_rectangle Select rectangle

Select a rectangle (image pixels, origin top-left) combined with the current selection. The part outside the canvas is ignored. Selections are part of the image (undoable, saved in XCF).

ParameterTypeDescription
height *integer
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
width *integer
x *integer
y *integer
feathernumberFeather radius in pixels (0 = hard edge).
operationstringHow the new shape combines with the current selection.

gimp_select_ellipse Select ellipse

Select the ellipse inscribed in the rectangle (x, y, width, height), antialiased, combined with the current selection. One undo step. By color or magic wand: gimp_select_by_color (toolset channels).

ParameterTypeDescription
height *integer
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
width *integer
x *integer
y *integer
feathernumberFeather radius in pixels (0 = hard edge).
operationstringHow the new shape combines with the current selection.

gimp_modify_selection Select all / none / invert

'all' selects the whole canvas, 'none' clears the selection, 'invert' inverts it. One undo step.

ParameterTypeDescription
action *string
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.

gimp_get_selection Get selection

Whether the image has a selection, its bounds, and optionally whether a point is selected.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
probe_x
probe_y

gimp_add_layer_mask Add layer mask

Add a mask to a layer or group. fill: 'white' (everything visible), 'black' (everything hidden), 'alpha' (from the layer's transparency), 'selection' (selected = visible; EMPTY_SELECTION if nothing is selected), 'grayscale' (from the layer's luminance). invert inverts it. Non-destructive: the layer's pixels are kept. One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
fillstring
invertboolean

gimp_set_layer_mask Configure layer mask

apply: whether the mask affects the rendering (disable to see the layer unmasked); show: display the mask itself; edit: make painting tools target the mask. One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
apply
edit
show

gimp_remove_layer_mask Remove layer mask

Remove a layer's mask. mode='apply' bakes it into the layer's alpha (destructive: hidden pixels become transparent); mode='discard' drops it (the layer is shown unmasked). One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
mode *string

gimp_fill Fill

Fill a layer (or layer mask) with a solid color. area='selection' fills the selected part only (EMPTY_SELECTION if nothing is selected); area='layer' fills the whole layer and ignores (but keeps) the selection. Destructive for the pixels it covers. One undo step.

ParameterTypeDescription
color *stringsRGB color as '#rrggbb', '#rrggbbaa', '#rgb' or one of: white, black, red, green, blue, transparent
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
areastring
modestringGIMP layer mode nick, e.g. normal, multiply, screen, overlay, soft-light, hard-light, addition, subtract, difference, darken-only, lighten-only, hue, saturation, color, dodge, burn, pass-through (grou…
opacitynumber0-100.

gimp_draw_path Draw line / polyline

Stroke a polyline through points [[x, y], ...] (image pixels, at least 2 points) with a plain line of the given width, color and opacity; closed=true joins the last point to the first. Uses a solid line, never the user's brush. Points outside the layer are clipped. One undo step.

ParameterTypeDescription
color *stringsRGB color as '#rrggbb', '#rrggbbaa', '#rgb' or one of: white, black, red, green, blue, transparent
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
points *array
antialiasboolean
capstring
closedboolean
joinstring
opacitynumber0-100.
widthnumberLine width in pixels.

gimp_draw_shape Draw rectangle / ellipse

Draw a rectangle or an ellipse (inscribed in x, y, width, height) on a layer, filled with fill_color and/or outlined with stroke_color (stroke centered on the outline). The image's selection is left unchanged. One undo step.

ParameterTypeDescription
height *number
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
shape *string
width *number
x *number
y *number
antialiasboolean
fill_colorsRGB color as '#rrggbb', '#rrggbbaa', '#rgb' or one of: white, black, red, green, blue, transparent
opacitynumber0-100.
stroke_colorsRGB color as '#rrggbb', '#rrggbbaa', '#rgb' or one of: white, black, red, green, blue, transparent
stroke_widthnumberLine width in pixels.

gimp_brightness_contrast Brightness / contrast

Adjust brightness and contrast of a layer, each from -100 to 100 (0 = unchanged; GIMP's -1..1 curve, not a percentage: on mid-gray 128, brightness -30 gives 119 (7% darker), -100 gives 92; contrast pivots on light gray, +30 turns 128 into 54). For 'N% darker/lighter' use gimp_hue_saturation lightness -N/+N. One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
brightnessnumber
contrastnumber
destructivebooleantrue: change the layer's pixels (respects the selection). false: add an editable GIMP filter on the layer (pixels untouched, removable, saved in XCF; applied to the whole layer).

gimp_hue_saturation Hue / saturation

Rotate hue (degrees, -180..180) and change saturation and lightness (-100..100, 0 = unchanged) of a layer, for all colors or one hue range. Lightness is proportional: -30 makes it 30% darker (mid-gray 128 -> 90), +30 goes 30% of the way to white (128 -> 166). One undo step. Levels, curves, exposure…: gimp_levels (toolset color).

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
destructivebooleantrue: change the layer's pixels (respects the selection). false: add an editable GIMP filter on the layer (pixels untouched, removable, saved in XCF; applied to the whole layer).
huenumber
hue_rangestring
lightnessnumber
overlapnumberBlend with neighbouring ranges, 0-100.
saturationnumber

gimp_gaussian_blur Gaussian blur

Blur a layer with a Gaussian of standard deviation `radius` pixels (radius_y defaults to radius). One undo step. Any other GEGL filter: gimp_apply_filter (toolset effects).

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
radius *numberStandard deviation in pixels.
destructivebooleantrue: change the layer's pixels (respects the selection). false: add an editable GIMP filter on the layer (pixels untouched, removable, saved in XCF; applied to the whole layer).
radius_y

gimp_list_filters List editable filters

Editable (non-destructive) filters attached to a layer.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.

gimp_remove_filter Remove editable filter

Remove an editable filter from a layer: the layer renders as if it had never been applied. One undo step.

ParameterTypeDescription
filter *stringFilter id from gimp_list_filters.
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.

gimp_create_text_layer Create text layer

Add an editable text layer. Position (x, y) is the top-left corner in image pixels. size is in size_unit ('px' or 'pt'). Without box_width/box_height the layer grows with the text; with both, the text wraps in a fixed box. The text stays editable (never rasterized). One undo step. Rich text, outlines, vertical text: gimp_set_text_style (toolset typography).

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
text *string
antialiasboolean
box_height
box_width
colorstringsRGB color as '#rrggbb', '#rrggbbaa', '#rgb' or one of: white, black, red, green, blue, transparent
fontstring
justifystring
letter_spacingnumber
line_spacingnumber
parentGroup id to put the layer in; null for the top level of the image.
positionintegerIndex within the parent, 0 = top-most (in front).
sizenumberFont size, in size_unit.
size_unitstring
xinteger
yinteger

gimp_set_text Edit text layer

Change the text, font, size, color, justification, spacing, box or position of an existing text layer; only given properties change. Refused with WRONG_KIND on non-text layers and with FONT_NOT_FOUND (nothing changed) for unknown fonts. One undo step.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
antialias
box_height
box_width
colorsRGB color as '#rrggbb', '#rrggbbaa', '#rgb' or one of: white, black, red, green, blue, transparent
font
justify
letter_spacing
line_spacing
size
size_unit
text
x
y

gimp_inspect_text Inspect text layer

Text, font, size and unit, color, justification, spacing, antialiasing and geometry.

ParameterTypeDescription
item *stringItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.

gimp_list_fonts List fonts

Fonts GIMP knows (fontconfig names), filtered by a substring.

ParameterTypeDescription
limitinteger
querystring

gimp_create_checkpoint Create checkpoint

Keep a full copy of the image's current state (layers, text, masks, filters, selection) so it can be restored later: this is how to undo/redo. Copies are hidden from image lists and use memory; at most 20 per image.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.
label

gimp_list_checkpoints List checkpoints

Checkpoints of an image, oldest first.

ParameterTypeDescription
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.

gimp_restore_checkpoint Restore checkpoint (undo/redo)

Replace the image with the state saved in a checkpoint. The restored image gets a NEW image id and new item ids (the old ones become invalid); GIMP windows showing it are reconnected; its file association is kept and it is marked as having unsaved changes; its GIMP undo history starts empty. Checkpoints are kept, so restoring a later one redoes. Destructive for the current state unless it was checkpointed.

ParameterTypeDescription
checkpoint *stringCheckpoint id from gimp_create_checkpoint.
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.

gimp_delete_checkpoint Delete checkpoint

Free a checkpoint's memory. Closing an image deletes its checkpoints too. Checkpoints are not in GIMP's undo history.

ParameterTypeDescription
checkpoint *stringCheckpoint id from gimp_create_checkpoint.

gimp_rotate_image Rotate image

Rotate the whole image (canvas, layers, selection, paths) by 90, 180 or 270 degrees clockwise. Lossless. One undo step.

ParameterTypeDescription
angle *integer
image *stringImage id from gimp_status, e.g. 'image:1@a1b2c3d4'.