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
| Name | Required | Description | Default |
|---|---|---|---|
| head | Yes | Standard padded base64 of the first bytes of the file (up to 32768 bytes decoded). | |
| tail | No | Optional base64 of the last bytes (up to 4096 decoded), used for end-of-file markers when head is not the whole file. | |
| complete | No | True when head is the entire file; end-of-file markers are then checked on it. | |
| totalSize | No | Optional total file size in bytes, for size-field comparisons (RIFF, MP4 boxes, ZIP directory). | |
| claimedMime | No | Claimed Content-Type, parameters ignored. | |
| claimedName | No | File name or path; the last extension is the claim. |