get_zip_statistics
Analyze remote ZIP archive statistics to understand file counts, sizes, and structure without downloading the entire archive.
Instructions
Get statistics about the remote zip archive.
Args:
url: URL of the remote zip file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes |
Implementation Reference
- remotezip_server.py:53-68 (handler)The main handler function for the 'get_zip_statistics' tool. It uses RemoteZip to access the zip archive at the given URL, retrieves the file info list, calculates total number of files, total uncompressed size, and total compressed size, then returns a formatted string with these statistics. Includes error handling.@mcp.tool() async def get_zip_statistics(url: str) -> str: """Get statistics about the remote zip archive. Args: url: URL of the remote zip file """ try: with RemoteZip(url) as zip_file: files = zip_file.infolist() total_files = len(files) total_size = sum(info.file_size for info in files) total_compressed = sum(info.compress_size for info in files) return f"Total files: {total_files}\nTotal uncompressed size: {total_size} bytes\nTotal compressed size: {total_compressed} bytes" except Exception as e: return f"Error getting statistics: {str(e)}"