scan_file_cdr
Submit files for Content Disarm and Reconstruction to remove potentially malicious content while preserving functionality, supporting archives with password protection and entry point specification.
Instructions
Submit a file for CDR (Content Disarm and Reconstruction) processing.
Args: file_path: Path to the file to process is_public: Whether the scan results should be public entrypoint: File to execute within archive (if applicable) password: Password for archive files (if applicable)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entrypoint | No | ||
| file_path | Yes | ||
| is_public | No | ||
| password | No |
Implementation Reference
- src/threatzone_mcp/server.py:403-432 (handler)The handler function for the 'scan_file_cdr' MCP tool. It checks if the file exists, prepares form data with optional parameters, and posts the file to the ThreatZone API endpoint '/public-api/scan/cdr' for CDR processing. The @app.tool decorator registers this function as an MCP tool.@app.tool async def scan_file_cdr( file_path: str, is_public: bool = False, entrypoint: Optional[str] = None, password: Optional[str] = None ) -> Dict[str, Any]: """ Submit a file for CDR (Content Disarm and Reconstruction) processing. Args: file_path: Path to the file to process is_public: Whether the scan results should be public entrypoint: File to execute within archive (if applicable) password: Password for archive files (if applicable) """ if not Path(file_path).exists(): raise ThreatZoneError(f"File not found: {file_path}") data = {"isPublic": is_public} if entrypoint: data["entrypoint"] = entrypoint if password: data["password"] = password files = {"file": open(file_path, "rb")} try: return await get_client().post("/public-api/scan/cdr", data=data, files=files) finally: files["file"].close()
- src/threatzone_mcp/server.py:403-403 (registration)The @app.tool decorator from FastMCP registers the scan_file_cdr function as an MCP tool.@app.tool