Skip to main content
Glama

Image to Base64 API - data URI, raw, HTML or CSS snippet

image_to_base64
Read-onlyIdempotent

Encode an image as a data URI, raw base64, an tag or a CSS background snippet. Runs on our server, files are deleted right after the call, nothing stored. Free: 5 calls/day per IP. Paid: Radar API key (from €9/mo at https://radarbg.com/pricing#starter via X-API-Key) or $0.001/call via x402 at https://radarbg.com/x402/image-to-base64.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "fileName": "sample.png",
      "fileContent": "iVBORw0KGgoAAAANSUhEUgAAAHgAAABQCAIAAABd+SbeAAAA6klEQVR4nO3cQQ2DABAAwdKgg1cFVQIykIOEyqiIisFDKdsQZv6XXDb3vmFa3jeOd//3AlchdEToiNARoSNCR4SOCB0ROiJ0ROiI0BGhI0JHhI4IHRE6InRE6Mi4Z/jznH+0xmk8Xut3gy46InRE6IjQEaEjQkeEjggdEToidEToiNARoSNCR4SOCB0ROiJ0ROiI0BGhI0JHhI4IHRE6InRE6IjQEaEjQkeEjggdEToidEToiNARoSNCR4SOCB0ZPIFtuOiI0BGhI0JHhI4IHRE6InRE6IjQEaEjQkeEjggdEToidEToiNCRDexBBl0OjJSaAAAAAElFTkSuQmCC"
    },
    "name": "image_to_base64"
  }
}

Input Schema

NameRequiredDescriptionDefault
filesNoOr several files: [{fileName, fileContent (base64)}]
outputNouri, raw, html or cssuri
fileNameNoFile name with extension, e.g. report.pdf
fileContentNoThe file as base64 (a data: URI is fine)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already mark this readOnly, idempotent and openWorld, and the description adds genuinely useful context beyond them: processing happens server-side, files are deleted immediately and nothing is retained, which addresses the obvious privacy concern about uploading image data. It also discloses the rate limit (5 calls/day per IP) and the two auth mechanisms (X-API-Key or x402 payment), though it stops short of stating input size limits or what happens with the multi-file 'files' array.

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?

Three sentences with the core capability front-loaded, followed by privacy then access terms; every sentence carries information. The pricing/auth sentence is dense with URLs and currency symbols but is legitimately needed for a paid endpoint.

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 zero required parameters, full schema coverage and no output schema, the description covers what an agent needs to call the tool and what shape the result takes. Minor gaps remain around the multi-file input and any size caps, which matter for a base64-encoding endpoint.

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, and the description adds no syntax or format detail beyond echoing the output options. Baseline 3 is appropriate given the schema does the heavy lifting.

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?

The description opens with a precise verb+resource ('Encode an image') and enumerates the four output shapes (data URI, raw base64, <img> tag, CSS background snippet), which maps directly onto the 'output' enum. It does not, however, differentiate itself from the sibling base64_encode_decode, so an agent must infer that this tool is the image-specific variant.

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 only implied: the enumeration of output formats tells the agent to pick a desired representation, but there is no explicit when-to-use/when-not-to-use statement and no pointer to the generic encoder sibling. The remaining content is about pricing and auth, not about selecting the tool.

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