Skip to main content
Glama

image.replace_background

[paid: $0.03] Replace a photo's background with a generated scene (Bria FIBO Edit). With no mask, the subject is cut out first (plus [paid: $0.0005]) and the original subject is laid back over the new scene; or pass a mask covering the background (white = background). Returns JSON {images:[{url, asset_key, download_url?, width, height}], price, next} plus a preview; images are stored in this workspace, never provider links, and a result with no download_url says why in download_url_unavailable. Refuses: SIMPLER_MEDIA_INPUT_MISSING (pass the url or the asset_key), SIMPLER_MEDIA_FOREIGN_KEY (use this workspace's asset_key), SIMPLER_MEDIA_URL_REFUSED (use https, data:image or an asset_key), SIMPLER_MEDIA_PIN_TOO_LARGE (under 20MB), VALIDATION_ERROR on an empty prompt (describe the scene), SIMPLER_EDIT_BACKDROP_NO_SUBJECT (no mask and no clear subject: pass a background mask), SIMPLER_IMAGE_PROMPT_REFUSED names the label (sexual, minor, real_person or other_unsafe): rewrite the prompt without it, for example no real person's name or likeness; SIMPLER_IMAGE_PROMPT_CHECK_UNAVAILABLE (the safety check is down, nothing charged: retry later); SIMPLER_IMAGE_OUTPUT_FLAGGED (the output failed the content check and was refunded: change the prompt); SIMPLER_IMAGE_OUTPUT_SCAN_UNAVAILABLE (outputs cannot be checked right now, nothing charged: retry later), INSUFFICIENT_CREDITS (add credits). SIMPLER_EDIT_RESULT_UNDELIVERED means the charge was refunded: retry. NEXT: pass images[0].asset_key as image_asset_key to the next image.* tool, or open download_url when the result carries one.

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": {
      "prompt": "<prompt>"
    },
    "name": "image.replace_background"
  }
}

Input Schema

NameRequiredDescriptionDefault
promptYesScene description.
mask_urlNoOptional background mask (white = background); omit it to cut the subject out automatically: a public https URL, a data:image/...;base64 URL, or the url/url_path of an earlier image result (max 20MB; PNG, JPEG, WebP or GIF; SVG is refused). Pass this or the matching *_asset_key, not both.
image_urlNoSource photo: a public https URL, a data:image/...;base64 URL, or the url/url_path of an earlier image result (max 20MB; PNG, JPEG, WebP or GIF; SVG is refused). Pass this or the matching *_asset_key, not both.
request_refNoOptional idempotency key (1-64 chars: letters, digits, . _ : -). Retrying with the same request_ref and the same arguments within 24 hours returns the first result at $0 with replayed: true; the same request_ref with different arguments is refused (SIMPLER_IMAGE_REQUEST_REF_CONFLICT), and so is a retry whose first result was deleted since (SIMPLER_IMAGE_REQUEST_REF_RESULT_DELETED): send a new request_ref to run it again.
mask_asset_keyNoOptional background mask (white = background); omit it to cut the subject out automatically, as the asset_key of an earlier image result for this workspace (edit-projects/<tenant>/... or images/<tenant>/...). A key from another workspace is refused (SIMPLER_MEDIA_FOREIGN_KEY).
preview_formatNoPreview block after the JSON, at most 384px on the long edge and never charged: png, jpeg or none. Left out, a PNG result gets a png preview and a JPEG or WebP result a jpeg one. A result with no preview says why in preview_unavailable.
image_asset_keyNoSource photo, as the asset_key of an earlier image result for this workspace (edit-projects/<tenant>/... or images/<tenant>/...). A key from another workspace is refused (SIMPLER_MEDIA_FOREIGN_KEY).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / mask_asset_key / description
      Previous value: -"Background mask (white = background), as the asset_key of an earlier image result for this workspace (edit-projects/<tenant>/... or images/<tenant>/...). A key from another workspace is refused (SIMPLER_MEDIA_FOREIGN_KEY)."New value: +"Optional background mask (white = background); omit it to cut the subject out automatically, as the asset_key of an earlier image result for this workspace (edit-projects/<tenant>/... or images/<tenant>/...). A key from another workspace is refused (SIMPLER_MEDIA_FOREIGN_KEY)."
    • changedInput schema / properties / mask_url / description
      Previous value: -"Background mask (white = background): a public https URL, a data:image/...;base64 URL, or the url/url_path of an earlier image result (max 20MB; PNG, JPEG, WebP or GIF; SVG is refused). Pass this or the matching *_asset_key, not both."New value: +"Optional background mask (white = background); omit it to cut the subject out automatically: a public https URL, a data:image/...;base64 URL, or the url/url_path of an earlier image result (max 20MB; PNG, JPEG, WebP or GIF; SVG is refused). Pass this or the matching *_asset_key, not both."
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes far beyond the single readOnlyHint=false annotation: exact pricing ($0.03 base, +$0.0005 for auto-cutout), refund semantics on undelivered/failed results, storage guarantees (results live in this workspace, never provider links), and a failure catalog with a remedy per code. That is precisely the behavioral context an agent needs before spending money.

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?

Front-loaded with the action and the price, then mechanics, then returns, then errors, then next step — a sensible order. The error enumeration is a long run-on paragraph, but each entry pairs a code with an actionable remedy, so the length largely earns its place.

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

Completeness5/5

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

There is no output schema, but the description spells out the return shape ({images:[{url, asset_key, download_url?, width, height}], price, next}), preview behavior, and why download_url may be absent. Combined with input refusals and refund handling, an agent has everything needed to call this paid, mutating tool correctly.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds semantics the schema does not: that omitting the mask triggers paid auto-cutout, that mask white = background, and that the result asset_key feeds the next call. The request_ref idempotency contract is echoed from the schema rather than extended, hence 4 rather than 5.

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 ('Replace a photo's background with a generated scene') and names the underlying model (Bria FIBO Edit), plus the two operating modes (auto subject cutout vs. supplied background mask). An agent can distinguish it from image.cut_background or image.replace_sky on the strength of the description alone.

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?

Gives explicit mode-selection guidance: omit the mask to cut the subject out automatically (for an extra $0.0005), or pass a background mask where white = background. It also closes with a NEXT section telling the agent to chain images[0].asset_key into the next image.* tool. It stops short of naming sibling alternatives (image.cut_background, image.inpaint, image.generate_for_edit) for adjacent use cases.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources