mcp_batch_process
Process multiple texts simultaneously to detect, anonymize, encrypt, or decrypt personally identifiable information using advanced cryptographic methods.
Instructions
MCP Tool: 여러 텍스트 일괄 처리
Args:
texts (List[str]): 처리할 텍스트 리스트
Returns:
Dict[str, Any]: 일괄 처리 결과
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| texts | Yes |
Implementation Reference
- mcp_pii_tools.py:556-569 (handler)The primary MCP tool handler function for 'mcp_batch_process', decorated with @mcp.tool() for automatic registration and execution. It instantiates MCPPIIProcessor and delegates to its batch_process method.@mcp.tool() def mcp_batch_process(texts: List[str]) -> Dict[str, Any]: """ MCP Tool: 여러 텍스트 일괄 처리 Args: texts (List[str]): 처리할 텍스트 리스트 Returns: Dict[str, Any]: 일괄 처리 결과 """ processor = MCPPIIProcessor() return processor.batch_process(texts)
- mcp_pii_tools.py:480-525 (helper)Core batch processing logic in MCPPIIProcessor class. Processes each text individually using process_text, aggregates results, and computes summary statistics.def batch_process(self, texts: List[str]) -> Dict[str, Any]: """ 여러 텍스트를 일괄 처리 (MCP Tool용) Args: texts (List[str]): 처리할 텍스트 리스트 Returns: Dict[str, Any]: MCP Tool 응답 형식 """ try: start_time = time.time() results = [] for i, text in enumerate(texts): result = self.process_text(text) result["index"] = i results.append(result) processing_time = time.time() - start_time # 전체 통계 total_pii = sum(result["count"] for result in results if result["success"]) successful_count = sum(1 for result in results if result["success"]) return { "success": True, "results": results, "total_texts": len(texts), "successful_count": successful_count, "total_pii_detected": total_pii, "processing_time": processing_time, "average_time_per_text": processing_time / len(texts) if texts else 0 } except Exception as e: return { "success": False, "error": str(e), "results": [], "total_texts": len(texts), "successful_count": 0, "total_pii_detected": 0, "processing_time": 0, "average_time_per_text": 0 }
- mcp_pii_tools.py:869-882 (schema)Explicit JSON schema definition for the mcp_batch_process tool input parameters in the MCP_TOOLS dictionary, defining the expected 'texts' array parameter."batch_process": { "name": "batch_process", "description": "여러 텍스트를 일괄적으로 PII(개인 정보) 처리합니다.", "parameters": { "type": "object", "properties": { "texts": { "type": "array", "items": {"type": "string"}, "description": "처리할 텍스트 리스트" } }, "required": ["texts"] }