Skip to main content
Glama

process_images

Process images in a directory with operations like enhancing, OCR, resizing, and deduplication, returning results in JSON format for streamlined image management.

Instructions

Process images in a directory with various operations. Args: image_dir: Directory containing images to process operations: List of operations (enhance, ocr, resize, deduplicate) ocr_language: Language for OCR processing (default: eng) Returns: JSON string with processing results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
image_dirYes
ocr_languageNoeng
operationsNo

Implementation Reference

  • The core handler and registration for the 'process_images' MCP tool. Decorated with @mcp.tool(), it processes images in a directory with specified operations (enhance, OCR, etc.) using an image processor, returning JSON results. The function signature provides input schema via type hints and defaults.
    @mcp.tool() async def process_images( image_dir: str, operations: List[str] = ["enhance"], ocr_language: str = "eng" ) -> str: """ Process images in a directory with various operations. Args: image_dir: Directory containing images to process operations: List of operations (enhance, ocr, resize, deduplicate) ocr_language: Language for OCR processing (default: eng) Returns: JSON string with processing results. """ try: ip = get_image_processor() results = ip.process_batch(image_dir, operations) # Add OCR language info to results if OCR was performed if "ocr" in operations: for ocr_result in results.get("ocr_results", []): ocr_result["language"] = ocr_language result = { "status": "success", "image_directory": image_dir, "operations": operations, "results": results } return json.dumps(result, indent=2) except Exception as e: logger.error(f"Failed to process images: {e}") return json.dumps({ "status": "error", "error": str(e), "image_directory": image_dir, "operations": operations })

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/PovedaAqui/auto-snap-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server