Skip to main content
Glama

set_image_from_base64

Sets an inventory item's photo or the company logo from a small image sent inline as base64. Use this for a photo the user pasted into the chat when you can run code on the file but your sandbox can't reach this server (otherwise prefer get_image_upload_link, which keeps the full-size photo). Shrink the image first: the decoded image must be 150 KB or less. In Python: from PIL import Image; import io, base64, hashlib; im = Image.open(path); im.thumbnail((512, 512)); buf = io.BytesIO(); im.convert("RGB").save(buf, "JPEG", quality=80); data = buf.getvalue(); print(hashlib.sha256(data).hexdigest()); print(base64.b64encode(data).decode()). Copy the base64 exactly and pass the SHA-256 too, so a copying slip is caught instead of saving a broken image.

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": {
      "target": "<target>",
      "imageBase64": "<imageBase64>"
    },
    "name": "set_image_from_base64"
  }
}

Input Schema

NameRequiredDescriptionDefault
sha256NoOptional but recommended: the SHA-256 of the image bytes as hex, used to detect copying mistakes.
targetYes"item" to set an inventory item's photo (also pass inventoryItemId), or "logo" to set the company logo.
imageBase64YesThe image bytes as base64 (a data:image/...;base64, prefix is allowed).
inventoryItemIdNoThe inventory item id when target is "item" (from get_inventory).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses a hard input constraint (decoded image must be 150 KB or less), why sha256 exists (detect copying slips rather than saving a broken image), and the tradeoff versus the upload-link alternative. It stops short of stating that an existing photo will be overwritten, whether permissions are required, or what the tool returns on success.

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 first two sentences front-load the purpose and the routing decision, and every prose sentence earns its place. The long inline Python snippet is actionable but disproportionate, dominating the description and burying the size constraint inside it rather than stating it as a standalone rule first.

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 four-parameter mutation tool with no output schema and no annotations, the description supplies the essential caller-side requirements: which target values pair with which parameters, the size ceiling, and the integrity check workflow. What remains missing is the overwrite behavior and any success/error return expectations.

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 target, imageBase64, inventoryItemId and sha256 are already documented in the schema, including the 'item' vs 'logo' semantics and the get_inventory source for the id. The description adds only the size ceiling and a restatement of the sha256 rationale; that is marginal value on top of a fully documented schema, so baseline 3.

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 two named resources ('Sets an inventory item's photo or the company logo') plus the transport mechanism ('inline as base64'). It also distinguishes itself from siblings by naming get_image_upload_link as the preferred path in other circumstances, so an agent can route correctly without opening a schema.

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

Usage Guidelines5/5

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

Gives an explicit when-to-use condition (user pasted a photo, you can run code locally, sandbox can't reach the server) and an explicit alternative with its tradeoff (get_image_upload_link keeps the full-size photo). This is exactly the routing information an agent needs when two image-setting paths exist.

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