Skip to main content
Glama

Preview file

preview_file
Read-onlyIdempotent

Show a file in a visual viewer where the client supports it: images and PDFs as they are, markdown rendered, other text files as a scrollable block. The result is a one-line description - use read_file to get the contents. Other file types are described rather than shown.

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>",
      "context": "<context>"
    },
    "name": "preview_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesFull path of one file including its filename, e.g. '/media/images/logo.png'.
contextYesExplain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): "Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization."

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, and closed-world, so the safety profile is covered. The description adds genuinely new behavior beyond that: the return value is only a one-line description, viewers degrade depending on client support, and unsupported types are described instead of shown — all of which an agent could not infer from the schema.

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 compact sentences, front-loaded with the capability, followed by the critical caveat about the return value. No filler and no repetition of schema or annotation content.

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 no output schema, the description carries the return-value burden and does so by stating the result is a one-line description. Remaining gaps are minor, such as error behavior for a nonexistent path, but the complexity is low and read-only.

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?

Both parameters have full schema description coverage (100%), including a detailed context-parameter contract, so the schema carries this dimension. The description adds no path format guidance or explanation of the context requirement, leaving it at the baseline for high coverage.

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?

The description names a specific verb and resource ("Show a file in a visual viewer") and enumerates exactly how each format is handled: images and PDFs as-is, markdown rendered, other text as a scrollable block. It also names the sibling it is not, telling the agent this does not return file contents.

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?

It explicitly redirects the agent to read_file for actual contents and flags the conditions under which preview is unavailable ("where the client supports it", "other file types are described rather than shown"). It does not spell out an explicit when-not-to-call rule beyond that, but the routing signal is strong.

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