Skip to main content
Glama

Encode or decode a local file as Base64

base64_convert_file
Read-onlyIdempotent

Encode a local file to Base64 or decode a Base64 text file without pasting contents; files are read-only and limited to 5 MB.

Instructions

Read a local file and encode its bytes to Base64, or decode a Base64 text file.

Use this when the data is in a file on this computer, so you don't have to paste it. The file is only read, never changed. Files larger than 5 MB are rejected; use the Apify version for bigger jobs. For decode, the file must be UTF-8 text containing Base64 (or a data URI), not a binary file.

path: full path to a file, up to 5 MB.

Returns the same result object as convert_text. If the decoded bytes are not UTF-8 text, "isText" is false and "text" is null.

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": {
      "path": "<path>"
    },
    "name": "base64_convert_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesFull path to a local file, up to 5 MB. For decode, the file must be UTF-8 text of Base64.
actionNoWhat to do. "auto" (default) decodes if the input looks like Base64, otherwise it encodes. Use "encode" or "decode" when you already know the direction.auto
data_uriNoIf true, encoded results also include a data: URI. The MIME type is guessed from the file name when we can.
url_safeNoIf true, encode with - and _ instead of + and /. Decoding always accepts both.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description adds real behavioral context beyond them: the file is only read and never changed, the 5 MB hard limit, the UTF-8-only decode precondition, and what happens on failure to decode ('isText' false and 'text' null).

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 core action and the usage rule, then constraints, then return behavior. The standalone 'path: full path to a file, up to 5 MB' line largely repeats the schema and the earlier size limit, which is minor redundancy.

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 tool with no output schema, it covers size limits, directionality, decode preconditions, and the key return fields. The return summary leans on 'the same result object as convert_text,' which is opaque without knowing that sibling, leaving a small gap.

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 documents all four parameters including action enum, data_uri, and url_safe. The description only re-states the path parameter's size and decode-format constraints and does not add meaning for the remaining three parameters, so baseline 3 applies.

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?

Specific verb+resource: reads a local file and encodes its bytes to Base64, or decodes a Base64 text file. It explicitly distinguishes itself from the pasted-text sibling by saying 'Use this when the data is in a file on this computer, so you don't have to paste it.'

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 positive conditions (data resides in a local file), an exclusion with an alternative ('Files larger than 5 MB are rejected; use the Apify version for bigger jobs'), and an input-format constraint for decode (UTF-8 text containing Base64 or a data URI, not binary).

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