Skip to main content
Glama

Remove background

remove_background

Removes solid or near-solid backgrounds from local images using color-distance keying and outputs transparent PNG or WebP files for compositing and design tasks.

Instructions

Remove a solid or near-solid background from a local image using color-distance keying, with optional auto border sampling, tolerance, feathering and despill. Outputs a transparent PNG or WebP. This is not ML/AI segmentation.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "image": "<image>"
    },
    "name": "remove_background"
  }
}

Input Schema

NameRequiredDescriptionDefault
imageYesAbsolute path to a local image on the machine running this MCP server.
despillNoRemove background-color spill from semi-transparent edge pixels.
featherNoSoft-edge width in the same 0-100 color-distance scale. 0 gives a hard edge.
qualityNoEncoder quality (1-100). Applies to JPEG, WebP, AVIF and TIFF output.
losslessNoUse lossless encoding where supported (WebP and AVIF).
file_nameNoOptional base file name; path separators are not allowed. The actual image format determines the extension. When multiple outputs are produced, -1, -2, ... suffixes are appended. Existing files are never overwritten.
toleranceNoColor-distance tolerance (0-100). Higher removes more shades close to the background.
output_dirNoAbsolute directory where the output file is saved. Defaults to IMG_OUTPUT_DIR, or ~/img-output. The directory is created automatically.
output_formatNoOutput format; PNG or WebP keep the transparency.png
background_colorNoBackground color to remove. If omitted, it is estimated from the image border.

Output Schema

NameRequiredDescriptionDefault
imageYes
sourceYes
detailsNo
operationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.1

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare it is not read-only, not open-world, not idempotent, and not destructive. The description adds meaningful method context (color-distance keying, border sampling, tolerance, feathering, despill) and output formats, but does not itself explain file creation, overwrite avoidance, or directory auto-creation, which are left to the schema.

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?

Three short sentences with no wasted wording. The core purpose and limitation are front-loaded, followed by output format and the explicit non-ML clarification.

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?

For a 10-parameter image-processing tool with 100% schema coverage and an output schema, the description gives enough context to understand what the tool does and when it is appropriate. It omits operational file-system details, but those are covered by the schema rather than 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 carries parameter meaning. The description mentions several concepts (auto border sampling, tolerance, feathering, despill) that map to parameters, but adds little beyond the schema's own detailed parameter descriptions.

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?

States a specific verb and resource ('Remove a ... background from a local image') and names the exact technique ('color-distance keying'). It also explicitly excludes ML/AI segmentation, which prevents an agent from mistaking it for a segmentation model.

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 clearly frames when this tool applies: solid or near-solid backgrounds via color keying. The clause 'This is not ML/AI segmentation' provides a useful when-not condition, though it does not explicitly compare against sibling editing tools or discuss unsuitable complex backgrounds beyond that implication.

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