mcp_encrypt_pii_item
Encrypts personally identifiable information (PII) items using advanced cryptographic methods to protect sensitive data while maintaining searchability and format preservation.
Instructions
MCP Tool: PII 항목 암호화
Args:
pii_value (str): 암호화할 PII 값
pii_type (str): PII 유형 (이름, 전화번호, 이메일 등)
Returns:
Dict[str, Any]: 암호화 결과
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pii_type | Yes | ||
| pii_value | Yes |
Implementation Reference
- mcp_pii_tools.py:586-617 (handler)MCP tool handler for mcp_encrypt_pii_item, decorated with @mcp.tool(). Calls PIICrypto.encrypt_pii_item to perform type-specific encryption (deterministic or FPE) and returns structured result.@mcp.tool() def mcp_encrypt_pii_item(pii_value: str, pii_type: str) -> Dict[str, Any]: """ MCP Tool: PII 항목 암호화 Args: pii_value (str): 암호화할 PII 값 pii_type (str): PII 유형 (이름, 전화번호, 이메일 등) Returns: Dict[str, Any]: 암호화 결과 """ try: crypto = PIICrypto() encrypted_value = crypto.encrypt_pii_item(pii_value, pii_type) return { "success": True, "original_value": pii_value, "encrypted_value": encrypted_value, "pii_type": pii_type, "encryption_method": "deterministic" if pii_type in crypto.deterministic_types else "fpe" } except Exception as e: return { "success": False, "error": str(e), "original_value": pii_value, "encrypted_value": "", "pii_type": pii_type }
- mcp_pii_tools.py:912-928 (schema)JSON schema definition for the encrypt_pii_item tool parameters (pii_value, pii_type), used for MCP tool documentation and validation."encrypt_pii_item": { "name": "encrypt_pii_item", "description": "개별 PII 항목을 암호화합니다. 이름, 주소, 이메일은 결정론적 암호화, 전화번호, 신용카드번호 등은 FPE(형식 유지 암호화)를 사용합니다.", "parameters": { "type": "object", "properties": { "pii_value": { "type": "string", "description": "암호화할 PII 값" }, "pii_type": { "type": "string", "description": "PII 유형 (이름, 전화번호, 이메일, 주소, 신용카드번호, 여권번호, 주민등록번호 등)" } }, "required": ["pii_value", "pii_type"] }
- pii_crypto.py:453-474 (helper)Core helper method in PIICrypto class that implements the encryption logic: chooses deterministic encryption for name/address/email or FPE for phone/card/etc. based on pii_type.def encrypt_pii_item(self, pii_value: str, pii_type: str) -> str: """ PII 항목을 유형에 따라 적절한 방식으로 암호화 Args: pii_value: PII 값 pii_type: PII 유형 Returns: 암호화된 값 """ if not pii_value: return pii_value if pii_type in self.deterministic_types: return self.deterministic_encrypt(pii_value, pii_type) elif pii_type in self.fpe_types: return self.fpe_encrypt(pii_value, pii_type) else: # 기본적으로 결정론적 암호화 사용 return self.deterministic_encrypt(pii_value, pii_type)