Skip to main content
Glama

magic-bytes

File type vs leading bytes (magic numbers, disguised HTML, truncation) — Compares a claimed file type (MIME type and/or file name) with the first bytes of the file, for an agent that is about to open, parse or forward a download. Detects PNG, JPEG, GIF, WebP, ZIP and OOXML (docx/xlsx/pptx), GZIP, PDF, MP4 (ftyp), ELF, PE, RAR, BMP, ICO and HTML, flags an HTML login or error page saved as a PDF/image/archive, and reports truncation from end-of-file markers when the last

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": {
      "head": "<head>"
    },
    "name": "magic-bytes"
  }
}

Input Schema

NameRequiredDescriptionDefault
headYesStandard padded base64 of the first bytes of the file (up to 32768 bytes decoded).
tailNoOptional base64 of the last bytes (up to 4096 decoded), used for end-of-file markers when head is not the whole file.
completeNoTrue when head is the entire file; end-of-file markers are then checked on it.
totalSizeNoOptional total file size in bytes, for size-field comparisons (RIFF, MP4 boxes, ZIP directory).
claimedMimeNoClaimed Content-Type, parameters ignored.
claimedNameNoFile name or path; the last extension is the claim.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden, and it delivers: it discloses the comparison behavior, the specific detections (magic numbers, disguised HTML, truncation from end-of-file markers) and that end-of-file checks depend on whether the head is the whole file. It never explicitly states that nothing is written or mutated, and it does not characterize the response, so a modest gap remains.

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?

Front-loads the core function and intended caller, then compresses the format list and edge cases into tight parentheticals. Dense but front-loaded, and no sentence is filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, detection scope and the truncation mechanism well, but with six parameters, an optional tail/complete split and no output schema, the agent is left guessing at the result shape (verdict fields, mismatch severity, per-format detail). Adequate for invocation, incomplete for interpreting what comes back.

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 all six parameters (head, tail, complete, totalSize, claimedMime, claimedName) are already documented in the schema. The description reinforces how head/tail drive truncation checks but adds no format or semantic detail beyond what the schema states, so the 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?

States a specific verb and resource: compares a claimed file type (MIME and/or name extension) against the actual leading bytes, and enumerates exactly which formats it detects (PNG, JPEG, GIF, WebP, ZIP/OOXML, GZIP, PDF, MP4 ftyp, ELF, PE, RAR, BMP, ICO, HTML). An agent can distinguish this from every sibling listed 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 Guidelines4/5

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

Explicitly scopes the intended caller — 'for an agent that is about to open, parse or forward a download' — which gives clear when-to-use context, and the HTML-login-page and truncation cases signal the situations it exists to catch. It stops short of naming an alternative tool or stating when not to use it, so it does not reach a 5.

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