mcp_batch_process
Process multiple texts simultaneously to detect, anonymize, encrypt, or decrypt personally identifiable information using GPT-4o-based detection and 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 main handler function for the 'mcp_batch_process' MCP tool. It is decorated with @mcp.tool() for automatic registration and delegates to MCPPIIProcessor.batch_process for the core logic.@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 helper method in MCPPIIProcessor class that implements the batch PII processing logic by iterating over texts and calling process_text on each.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)JSON schema definition for the batch_process tool input parameters, specifying 'texts' as a required array of strings."batch_process": { "name": "batch_process", "description": "여러 텍스트를 일괄적으로 PII(개인 정보) 처리합니다.", "parameters": { "type": "object", "properties": { "texts": { "type": "array", "items": {"type": "string"}, "description": "처리할 텍스트 리스트" } }, "required": ["texts"] }
- mcp_pii_tools.py:556-569 (registration)The @mcp.tool() decorator registers the function as an MCP tool named 'mcp_batch_process'.@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)