Skip to main content
Glama

Read Media File

read_media_file
Read-onlyIdempotent

Reads a file as base64-encoded content with its MIME type, returning images or audio as media content and other files as embedded resources, restricted to allowed directories.

Instructions

Read a file and return it as a base64-encoded content block with its MIME type. Image and audio files are returned as image/audio content; any other file type is returned as an embedded resource. Only works within allowed directories.

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": "read_media_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesThe image, audio or other file to read as base64. Absolute, or relative to an allowed directory; it must resolve inside the allowed directories.

Output Schema

NameRequiredDescriptionDefault
contentYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description earns credit beyond that by disclosing the response encoding (base64), the MIME type accompanying it, and the branching behavior by file type, plus the sandboxing constraint that only allowed directories work. It stops short of stating size limits or what happens on a rejected path.

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, front-loaded with the action and return format, then the type-dependent branching, then the access constraint. No filler, no repetition of the title, and each sentence carries distinct information.

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?

The tool is simple, the schema is fully documented, and an output schema exists, so return values need only light coverage and the description still explains the content-block shape. The one gap is sibling routing: nothing tells the agent when to reach for this instead of read_file or read_text_file.

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% and the single path parameter already documents that it may be absolute or relative and must resolve inside allowed directories. The description restates the allowed-directory constraint but adds no new syntax or format detail, so the baseline of 3 applies.

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?

States a specific verb and resource ('Read a file') and pins down the return shape: base64 content block plus MIME type, with image/audio returned as media content and everything else as an embedded resource. That return-shape detail implicitly separates it from text-oriented siblings, but it never names read_file or read_text_file, so the agent must infer the boundary rather than being told.

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 agent can infer this is the tool for image/audio/binary files because of the base64 and MIME-type framing. There is no explicit statement of when to prefer this over read_file, read_text_file, or read_multiple_files, and no guidance on handling failures such as a path outside the allowed directories.

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