get_file_info
Retrieve metadata about specific files within remote zip archives using URL and filename inputs to access file details without full archive downloads.
Instructions
Get information about a specific file in the remote zip archive.
Args:
url: URL of the remote zip file
filename: Name of the file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | ||
| url | Yes |
Implementation Reference
- remotezip_server.py:38-51 (handler)The handler function for the 'get_file_info' tool, decorated with @mcp.tool(). It retrieves metadata (filename, size, compressed size) for a specific file within a remote ZIP archive using the RemoteZip library.@mcp.tool() async def get_file_info(url: str, filename: str) -> str: """Get information about a specific file in the remote zip archive. Args: url: URL of the remote zip file filename: Name of the file """ try: with RemoteZip(url) as zip_file: info = zip_file.getinfo(filename) return f"Filename: {info.filename}\nSize: {info.file_size} bytes\nCompressed size: {info.compress_size} bytes" except Exception as e: return f"Error getting file info: {str(e)}"
- remotezip_server.py:38-38 (registration)The @mcp.tool() decorator registers the get_file_info function as an MCP tool.@mcp.tool()
- remotezip_server.py:39-45 (schema)Type hints and docstring define the input schema (url: str, filename: str) and output (str describing file info).async def get_file_info(url: str, filename: str) -> str: """Get information about a specific file in the remote zip archive. Args: url: URL of the remote zip file filename: Name of the file """