download_image
Download images from URLs and save them to specified file paths for use in ComfyUI workflows.
Instructions
Download an image from a URL and save it to a file.
Args:
url: The URL of the image to download.
save_path: The absolute path to save the image to. Must be an absolute path, otherwise the image will be saved relative to the server location.
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>",
"save_path": "<save_path>"
},
"name": "download_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| save_path | Yes |
Implementation Reference
- src/server.py:33-42 (handler)The handler function for the 'download_image' tool. It is registered via the @mcp.tool() decorator. Downloads an image from the provided URL and saves it to the specified path using urllib.request.urlretrieve, then returns a success indicator. The function signature and docstring define the input schema.
@mcp.tool() async def download_image(url: str, save_path: str) -> Any: """Download an image from a URL and save it to a file. Args: url: The URL of the image to download. save_path: The absolute path to save the image to. Must be an absolute path, otherwise the image will be saved relative to the server location. """ urllib.request.urlretrieve(url, save_path) return {"success": True}