download_comses_model
Download and safely extract a COMSES model archive. Resolves version, checks size, enforces byte cap, and prevents path traversal.
Instructions
Download and safely extract a COMSES model archive.
Standalone "fetch but don't open" tool. Most AI flows should use
open_comses_model instead — it subsumes this tool and also loads
NetLogo models into the workspace.
Safety guarantees:
version="latest"is resolved to a concrete version BEFORE any cache path is computed. Cache dirs are named by the resolved version.HEAD request screens oversize archives before streaming.
Stream enforces the byte cap mid-download; overruns abort and delete the partial file.
Zip members are validated against path traversal before extraction.
Uncompressed total is checked against 2 × cap to reject zip bombs.
Extract happens in a temp directory; only a successful extract is moved atomically into the cache. A
.comses_completemarker is written on success; future calls only trust cached dirs with the marker.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_mb | No | Size cap in MB. Pass 0 or omit to use the `COMSES_MAX_DOWNLOAD_MB` env var (default 50 MB). | |
| version | No | Version string (e.g. "1.2.0") or "latest". | latest |
| identifier | Yes | Full model UUID (from `search_comses`). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |