Identify file type
identify_file_typeDetects a file's true type from magic bytes and checks whether its extension matches, useful when an extension may lie.
Instructions
Identify one file's real type from its content (magic bytes) and check the extension against it. Use when: an extension may lie, or encoding and line endings matter. Instead: scan_file_types for a folder; get_path_info for size and date. Requires: --mcp-tools filetype. Behavior: read-only; reads at most max_bytes. An unreadable or missing file is a result (kind error); reading gives up after 15 s per file (kind timeout). Refuses secret files. Time limit: 60 s. Returns: {path, name, kind, verdict (match|mismatch|unknown), mismatch, mime, extension, encoding, line_endings, engine, ...}; outputSchema describes each.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "identify_file_type"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | The file to identify (absolute, or relative to the MCP root). Required unless path_b64 is given. | |
| backend | No | Backend id from list_backends; omit for the default. | |
| path_b64 | No | path as base64 of its raw bytes, for non-UTF-8 names; replaces path. | |
| max_bytes | No | Bytes read from the start of the file for the content check (64 KiB default, at most 1 MiB). | |
| use_file_command | No | Also run the file(1) command for its description (file_command); local regular files only, ignored on remote backends. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | special: a FIFO, device or socket (not read); error, timeout, cancelled: not read, error says why and the type fields are empty | |
| mime | No | the content's MIME type; '' when unknown | |
| name | Yes | its file name | |
| path | Yes | the file as asked for | |
| size | No | bytes; null when not known | |
| error | No | why the type fields are empty; '' when read | |
| engine | No | what decided: 'Qt', 'puremagic', 'signature table', 'text heuristic', 'disk image' or 'size' | |
| verdict | Yes | content against extension; unknown: no extension claim, or the content cannot tell | |
| encoding | No | text only: 'ASCII', 'UTF-8', a BOM's name or a guess; '' for binary | |
| mismatch | Yes | verdict == 'mismatch' | |
| extension | No | the name's extension, e.g. '.png'; '' for none | |
| bytes_read | No | bytes of content read (at most max_bytes) | |
| description | No | the content type in words, e.g. 'PNG image'; '' when unknown | |
| file_command | No | file(1)'s description, local only; '' when unavailable | |
| line_endings | No | text only: 'LF', 'CRLF', 'CR', 'mixed (...)' or 'none' | |
| extension_mime | No | the MIME type the extension claims; '' when it is unknown |