Skip to main content
Glama
czangyeob
by czangyeob

mcp_encrypt_text_pii

Detect and encrypt personally identifiable information in text using GPT-4o-based detection and advanced cryptographic methods for data protection.

Instructions

MCP Tool: 텍스트에서 PII를 탐지하고 암호화 Args: text (str): 처리할 텍스트 Returns: Dict[str, Any]: 암호화 처리 결과

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes

Implementation Reference

  • The handler function for mcp_encrypt_text_pii. Detects PII in the input text, encrypts each PII item using PIICrypto, replaces them in the text, and returns the encrypted text along with mappings and details.
    @mcp.tool() def mcp_encrypt_text_pii(text: str) -> Dict[str, Any]: """ MCP Tool: 텍스트에서 PII를 탐지하고 암호화 Args: text (str): 처리할 텍스트 Returns: Dict[str, Any]: 암호화 처리 결과 """ try: start_time = time.time() # 1. PII 탐지 detection_result = mcp_detect_pii(text) if not detection_result["success"]: return detection_result if not detection_result["pii_items"]: return { "success": True, "original_text": text, "encrypted_text": text, "pii_items": [], "encrypted_items": {}, "count": 0, "processing_time": time.time() - start_time, "summary": {} } # 2. PII 항목들 암호화 crypto = PIICrypto() encrypted_items = {} encrypted_text = text for item in detection_result["pii_items"]: pii_type = item["type"] pii_value = item["value"] # 암호화 encrypted_value = crypto.encrypt_pii_item(pii_value, pii_type) encrypted_items[pii_value] = encrypted_value # 텍스트에서 치환 encrypted_text = encrypted_text.replace(pii_value, encrypted_value) processing_time = time.time() - start_time return { "success": True, "original_text": text, "encrypted_text": encrypted_text, "pii_items": detection_result["pii_items"], "encrypted_items": encrypted_items, "count": len(detection_result["pii_items"]), "processing_time": processing_time, "summary": detection_result["summary"] } except Exception as e: return { "success": False, "error": str(e), "original_text": text, "encrypted_text": text, "pii_items": [], "encrypted_items": {}, "count": 0, "processing_time": 0, "summary": {} }
  • Schema definition for the mcp_encrypt_text_pii tool parameters in the MCP_TOOLS dictionary.
    "encrypt_text_pii": { "name": "encrypt_text_pii", "description": "텍스트에서 PII를 탐지하고 모든 PII를 암호화합니다. 검색 가능한 암호화된 텍스트를 생성합니다.", "parameters": { "type": "object", "properties": { "text": { "type": "string", "description": "처리할 텍스트" } }, "required": ["text"] }
  • The @mcp.tool() decorator registers the mcp_encrypt_text_pii function as an MCP tool.
    @mcp.tool()

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/czangyeob/mcp-pii-tools'

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