{
  "name": "file-type-detect",
  "summary": "Detects a remote file's true type from its magic bytes, returning the canonical extension and media type.",
  "rationale": "Trusting a URL extension or a server content-type is exactly how an agent mislabels a payload; deciding the type from the bytes needs a signature database and a hardened fetch an agent should not run inline.",
  "family": "archives",
  "price_usd": "0.003",
  "free": false,
  "timeout_ms": 30000,
  "max_timeout_seconds": 51,
  "input_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "url": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri",
        "description": "Absolute http(s) URL of the file, up to 2048 characters; redirects are followed, the whole body (at most 32 MB) is downloaded, and the type comes from its magic bytes, ignoring the extension and content-type header."
      }
    },
    "required": [
      "url"
    ],
    "additionalProperties": false
  },
  "input_example": {
    "url": "https://grist.tools/samples/archives/bundle.zip"
  },
  "output_example": {
    "source_url": "https://grist.tools/samples/archives/bundle.zip",
    "bytes": 639,
    "detected": true,
    "ext": "zip",
    "mime": "application/zip"
  },
  "errors": [
    "invalid_input",
    "blocked_target",
    "unreachable_target",
    "upstream_timeout",
    "too_large",
    "unprocessable",
    "internal"
  ]
}