Skip to main content
Glama

WritersLogic verifiable AI agents

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

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources