Skip to main content
Glama
czangyeob

MCP PII Tools

by czangyeob

mcp_decrypt_pii_item

Decrypt encrypted personally identifiable information (PII) data items using advanced cryptographic methods. Specify the encrypted value and PII type to retrieve the original data.

Instructions

MCP Tool: PII 항목 복호화

Args:
    encrypted_value (str): 복호화할 암호화된 값
    pii_type (str): PII 유형
    
Returns:
    Dict[str, Any]: 복호화 결과

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encrypted_valueYes
pii_typeYes

Implementation Reference

  • MCP tool handler function for mcp_decrypt_pii_item. Instantiates PIICrypto and calls its decrypt_pii_item method, returning a standardized response dictionary.
    @mcp.tool()
    def mcp_decrypt_pii_item(encrypted_value: str, pii_type: str) -> Dict[str, Any]:
        """
        MCP Tool: PII 항목 복호화
        
        Args:
            encrypted_value (str): 복호화할 암호화된 값
            pii_type (str): PII 유형
            
        Returns:
            Dict[str, Any]: 복호화 결과
        """
        try:
            crypto = PIICrypto()
            decrypted_value = crypto.decrypt_pii_item(encrypted_value, pii_type)
            
            return {
                "success": True,
                "encrypted_value": encrypted_value,
                "decrypted_value": decrypted_value,
                "pii_type": pii_type,
                "decryption_method": "deterministic" if pii_type in crypto.deterministic_types else "fpe"
            }
        except Exception as e:
            return {
                "success": False,
                "error": str(e),
                "encrypted_value": encrypted_value,
                "decrypted_value": "",
                "pii_type": pii_type
            }
  • JSON schema and metadata definition for the decrypt_pii_item tool in MCP_TOOLS dictionary, specifying parameters, types, descriptions, and required fields.
    "decrypt_pii_item": {
        "name": "decrypt_pii_item",
        "description": "암호화된 PII 항목을 복호화합니다.",
        "parameters": {
            "type": "object",
            "properties": {
                "encrypted_value": {
                    "type": "string",
                    "description": "복호화할 암호화된 값"
                },
                "pii_type": {
                    "type": "string",
                    "description": "PII 유형 (암호화 시 사용한 유형과 동일해야 함)"
                }
            },
            "required": ["encrypted_value", "pii_type"]
        }
    },
  • Core helper method in PIICrypto class that performs the actual decryption: chooses deterministic_decrypt or fpe_decrypt based on pii_type.
    def decrypt_pii_item(self, encrypted_value: str, pii_type: str) -> str:
        """
        암호화된 PII 항목을 복호화
        
        Args:
            encrypted_value: 암호화된 값
            pii_type: PII 유형
            
        Returns:
            복호화된 값
        """
        if not encrypted_value:
            return encrypted_value
        
        if pii_type in self.deterministic_types:
            return self.deterministic_decrypt(encrypted_value, pii_type)
        elif pii_type in self.fpe_types:
            return self.fpe_decrypt(encrypted_value, pii_type)
        else:
            # 기본적으로 결정론적 복호화 사용
            return self.deterministic_decrypt(encrypted_value, pii_type)

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