extract_file
Extract specific files from remote zip archives without downloading the entire archive. Download individual files from zip files hosted online to your local storage.
Instructions
Extract a specific file from a remote zip archive to local storage.
Args:
url: URL of the remote zip file
filename: Name of the file to extract
local_path: Local directory to extract to (default: current directory)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| filename | Yes | ||
| local_path | No | . |
Implementation Reference
- remotezip_server.py:23-36 (handler)The main handler function for the 'extract_file' tool, decorated with @mcp.tool() for registration. It extracts a specified file from a remote ZIP archive using RemoteZip and saves it to a local path.async def extract_file(url: str, filename: str, local_path: str = ".") -> str: """Extract a specific file from a remote zip archive to local storage. Args: url: URL of the remote zip file filename: Name of the file to extract local_path: Local directory to extract to (default: current directory) """ try: with RemoteZip(url) as zip_file: zip_file.extract(filename, local_path) return f"Extracted {filename} to {local_path}" except Exception as e: return f"Error extracting file: {str(e)}"