download_model
Downloads a model file into the correct ComfyUI models subdirectory, validating the filename and extension and using atomic writes to prevent corrupt partial downloads.
Instructions
Download a model file into the right ComfyUI models subdirectory.
The contract is deliberately tight, because this writes into the user's model tree:
filenamemust be a bare name -- no path separators, no...The extension must be plausible for the model type, so a stray
.shcannot be dropped intomodels/.Only
http/httpsURLs are fetched, and redirects are not followed to non-HTTP schemes.The write is atomic: a partial download lands on a
.partfile and is renamed only on success, so an interrupted transfer can never leave a corrupt.safetensorsthat ComfyUI will later try to load.
api_token is sent as a bearer header for gated hosts and is never
logged. It may also be supplied via COMFYUI_DOWNLOAD_TOKEN so it does
not have to travel through a tool argument.
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": {
"url": "<url>",
"filename": "<filename>",
"model_type": "<model_type>"
},
"name": "download_model"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| filename | Yes | ||
| api_token | No | ||
| model_type | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||