{
  "name": "archive-inspect",
  "summary": "Lists the entries of a remote zip, tar or tar.gz (paths, sizes, compression and CRC) without extracting any of them.",
  "rationale": "Seeing inside an archive without extracting it needs a real zip/tar reader and a hardened fetch, plus the decompression-bomb care that reads declared sizes instead of inflating, not something an agent does inline.",
  "family": "archives",
  "price_usd": "0.003",
  "free": false,
  "timeout_ms": 60000,
  "max_timeout_seconds": 81,
  "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 archive (at most 100 MB, also the cap on an inflated tar.gz), up to 2048 characters; redirects are followed and the format (zip, tar or gzip-compressed tar) is decided from the magic bytes, not the extension."
      },
      "max_entries": {
        "default": 1000,
        "description": "How many entries to list, 1 to 10000 (default 1000), taken in archive order and then sorted by name; any beyond the limit still count in total_entries and set truncated.",
        "type": "integer",
        "minimum": 1,
        "maximum": 10000
      }
    },
    "required": [
      "url"
    ],
    "additionalProperties": false
  },
  "input_example": {
    "url": "https://grist.tools/samples/archives/bundle.zip",
    "max_entries": 1000
  },
  "output_example": {
    "source_url": "https://grist.tools/samples/archives/bundle.zip",
    "kind": "zip",
    "compression": "none",
    "entry_count": 5,
    "total_entries": 5,
    "total_uncompressed_bytes": 159,
    "encrypted": false,
    "truncated": false,
    "entries": [
      {
        "name": "data/",
        "is_directory": true,
        "entry_type": "directory",
        "size": 0,
        "compressed_size": 0,
        "compression": "none",
        "encrypted": false,
        "crc32": "00000000"
      },
      {
        "name": "data/squares.csv",
        "is_directory": false,
        "entry_type": "file",
        "size": 31,
        "compressed_size": 33,
        "compression": "deflate",
        "encrypted": false,
        "crc32": "89761172"
      },
      {
        "name": "docs/",
        "is_directory": true,
        "entry_type": "directory",
        "size": 0,
        "compressed_size": 0,
        "compression": "none",
        "encrypted": false,
        "crc32": "00000000"
      },
      {
        "name": "docs/readme.md",
        "is_directory": false,
        "entry_type": "file",
        "size": 116,
        "compressed_size": 94,
        "compression": "deflate",
        "encrypted": false,
        "crc32": "b6cd27c3"
      },
      {
        "name": "hello.txt",
        "is_directory": false,
        "entry_type": "file",
        "size": 12,
        "compressed_size": 12,
        "compression": "store",
        "encrypted": false,
        "crc32": "af083b2d"
      }
    ]
  },
  "errors": [
    "invalid_input",
    "blocked_target",
    "unreachable_target",
    "upstream_timeout",
    "unsupported_content_type",
    "too_large",
    "unprocessable",
    "internal"
  ]
}