download_by_filename
Download a ComfyUI output file by filename without needing a prompt_id, saving it locally or returning base64 data with optional image format conversion.
Instructions
Download an output file by filename (no prompt_id needed). Uses GET /view. Use when you have filename from get_history or get_last_output. If return_base64 is true, file is not written to disk; returns base64 data. When size > 800 KB, automatically converts to WebP to stay under 1MB base64 limits. Use output_format to convert to png, jpeg, or webp. Requires COMFYUI_HOST.
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": {
"filename": "<filename>",
"dest_path": "<dest_path>"
},
"name": "download_by_filename"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | View type (default "output") | |
| filename | Yes | Output filename (e.g. from get_last_output or get_history) | |
| dest_path | Yes | Local path to save the file (ignored when return_base64 is true) | |
| subfolder | No | Subfolder (default empty) | |
| output_format | No | Convert image to this format (png, jpeg, or webp) before saving or returning base64 | |
| return_base64 | No | If true, return file as base64 (auto WebP when > 800 KB) | |
| convert_quality | No | WebP/JPEG quality when converting (default 85) | |
| max_base64_bytes | No | When return_base64 and file size > this, convert to WebP (default 819200). Set 0 to disable. |