Skip to main content
Glama
enkryptai

Enkrypt AI MCP Server

Official
by enkryptai

use_policy_to_detect

Apply a specified policy to identify and analyze violations within text inputs, supporting real-time safety and compliance monitoring in AI applications.

Instructions

Use a policy to detect violations in the provided text.

Args: policy_name: The name of the policy to use for detection. text: The text to check for policy violations.

Returns: A dictionary containing the response message and details of the detection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
policy_nameYes
textYes

Implementation Reference

  • The handler function for the 'use_policy_to_detect' tool. It is registered via the @mcp.tool() decorator. The function takes a policy_name and text, calls guardrails_client.policy_detect, and returns the result as a dictionary.
    @mcp.tool()
    def use_policy_to_detect(policy_name: str, text: str) -> Dict[str, Any]:
        """
        Use a policy to detect violations in the provided text.
    
        Args:
            policy_name: The name of the policy to use for detection.
            text: The text to check for policy violations.
    
        Returns:
            A dictionary containing the response message and details of the detection.
        """
        # Use policy to detect
        policy_detect_response = guardrails_client.policy_detect(
            policy_name=policy_name,
            text=text
        )
    
        # Return the response as a dictionary
        return policy_detect_response.to_dict()

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/enkryptai/enkryptai-mcp-server'

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