@mcp.tool() def deidentify_file(input_path: str, output_dir: str = "") -> dict: """De-identify a single medical image (DICOM, JPEG, or PNG). Scrubs DICOM header PHI and redacts burned-in pixel PHI using OCR and NER. Returns summary statistics and the output location only, never the redacted text or any pixel data. """ ... return { "status": "success", "source_file": src.name, "output_dir": str(out), "pixel_regions_detected": len(pixel_rows), "pixel_decisions": decisions, # e.g. {"redacted": 4, "safelisted": 10} "header_tags_scrubbed": tags_scrubbed, "needs_manual_review": decisions.get("low_confidence", 0) > 0, }