Skip to main content
Glama
enkryptai

Enkrypt AI MCP Server

Official
by enkryptai

guardrails_detect

Identify sensitive content in text by configuring detectors for injection attacks, PII, NSFW, toxicity, and policy violations. Provides safety assessments for compliance and risk mitigation.

Instructions

Detect sensitive content using Guardrails.

Args: ctx: The context object containing the request context. text: The text to detect sensitive content in. detectors_config: Dictionary of detector configurations. Each key should be the name of a detector, and the value should be a dictionary of settings for that detector. Available detectors and their configurations are as follows:

                  - injection_attack: Configured using InjectionAttackDetector model. Example: {"enabled": True}
                  - pii: Configured using PiiDetector model. Example: {"enabled": False, "entities": ["email", "phone"]}
                  - nsfw: Configured using NsfwDetector model. Example: {"enabled": True}
                  - toxicity: Configured using ToxicityDetector model. Example: {"enabled": True}
                  - topic: Configured using TopicDetector model. Example: {"enabled": True, "topic": ["politics", "religion"]}
                  - keyword: Configured using KeywordDetector model. Example: {"enabled": True, "banned_keywords": ["banned_word1", "banned_word2"]}
                  - policy_violation: Configured using PolicyViolationDetector model. Example: {"enabled": True, "need_explanation": True, "policy_text": "Your policy text here"}
                  - bias: Configured using BiasDetector model. Example: {"enabled": True}
                  - copyright_ip: Configured using CopyrightIpDetector model. Example: {"enabled": True}
                  - system_prompt: Configured using SystemPromptDetector model. Example: {"enabled": True, "index": "system_prompt_index"}
                  
                  Example usage: 
                  {
                      "injection_attack": {"enabled": True}, 
                      "nsfw": {"enabled": True}
                  }

Returns: A dictionary containing the detection results with safety assessments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
detectors_configYes
textYes

Implementation Reference

  • The handler function for 'guardrails_detect' tool. It is decorated with @mcp.tool() which registers it with the MCP server. The function detects sensitive content in the given text using specified detector configurations via the guardrails_client.
    def guardrails_detect(text: str, detectors_config: Dict[str, Any]) -> Dict[str, Any]:
        """
        Detect sensitive content using Guardrails.
    
        Args:
            ctx: The context object containing the request context.
            text: The text to detect sensitive content in.
            detectors_config: Dictionary of detector configurations. 
                              Each key should be the name of a detector, and the value should be a dictionary of settings for that detector.
                              Available detectors and their configurations are as follows:
                              
                              - injection_attack: Configured using InjectionAttackDetector model. Example: {"enabled": True}
                              - pii: Configured using PiiDetector model. Example: {"enabled": False, "entities": ["email", "phone"]}
                              - nsfw: Configured using NsfwDetector model. Example: {"enabled": True}
                              - toxicity: Configured using ToxicityDetector model. Example: {"enabled": True}
                              - topic: Configured using TopicDetector model. Example: {"enabled": True, "topic": ["politics", "religion"]}
                              - keyword: Configured using KeywordDetector model. Example: {"enabled": True, "banned_keywords": ["banned_word1", "banned_word2"]}
                              - policy_violation: Configured using PolicyViolationDetector model. Example: {"enabled": True, "need_explanation": True, "policy_text": "Your policy text here"}
                              - bias: Configured using BiasDetector model. Example: {"enabled": True}
                              - copyright_ip: Configured using CopyrightIpDetector model. Example: {"enabled": True}
                              - system_prompt: Configured using SystemPromptDetector model. Example: {"enabled": True, "index": "system_prompt_index"}
                              
                              Example usage: 
                              {
                                  "injection_attack": {"enabled": True}, 
                                  "nsfw": {"enabled": True}
                              }
    
        Returns:
            A dictionary containing the detection results with safety assessments.
        """
        
        response = guardrails_client.detect(text=text, config=detectors_config)
        
        return response.to_dict()
  • The @mcp.tool() decorator registers the guardrails_detect function as an MCP tool.
    def guardrails_detect(text: str, detectors_config: Dict[str, Any]) -> Dict[str, Any]:
  • The docstring provides the input schema details for detectors_config, listing available detectors and their configuration options.
    """
    Detect sensitive content using Guardrails.
    
    Args:
        ctx: The context object containing the request context.
        text: The text to detect sensitive content in.
        detectors_config: Dictionary of detector configurations. 
                          Each key should be the name of a detector, and the value should be a dictionary of settings for that detector.
                          Available detectors and their configurations are as follows:
                          
                          - injection_attack: Configured using InjectionAttackDetector model. Example: {"enabled": True}
                          - pii: Configured using PiiDetector model. Example: {"enabled": False, "entities": ["email", "phone"]}
                          - nsfw: Configured using NsfwDetector model. Example: {"enabled": True}
                          - toxicity: Configured using ToxicityDetector model. Example: {"enabled": True}
                          - topic: Configured using TopicDetector model. Example: {"enabled": True, "topic": ["politics", "religion"]}
                          - keyword: Configured using KeywordDetector model. Example: {"enabled": True, "banned_keywords": ["banned_word1", "banned_word2"]}
                          - policy_violation: Configured using PolicyViolationDetector model. Example: {"enabled": True, "need_explanation": True, "policy_text": "Your policy text here"}
                          - bias: Configured using BiasDetector model. Example: {"enabled": True}
                          - copyright_ip: Configured using CopyrightIpDetector model. Example: {"enabled": True}
                          - system_prompt: Configured using SystemPromptDetector model. Example: {"enabled": True, "index": "system_prompt_index"}
                          
                          Example usage: 
                          {
                              "injection_attack": {"enabled": True}, 
                              "nsfw": {"enabled": True}
                          }
    
    Returns:
        A dictionary containing the detection results with safety assessments.
    """
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes what the tool does (detects sensitive content) and provides configuration details for detectors, but doesn't disclose behavioral traits such as performance characteristics, rate limits, authentication needs, or what happens if no sensitive content is found. The description adds some context but lacks comprehensive behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately front-loaded with the core purpose, but it becomes verbose with detailed detector configurations and examples. While this information is valuable, it could be more structured or concise. Some sentences (like the extensive detector list) might benefit from better organization, but overall, it's not overly redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (2 parameters with nested objects, no output schema, no annotations), the description is fairly complete. It covers the purpose, parameters in detail, and return value format. However, it lacks output schema details (e.g., structure of 'dictionary containing detection results'), and without annotations, it misses behavioral context like error handling or side effects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description must compensate, and it does so effectively. It explains the 'text' parameter as 'The text to detect sensitive content in' and provides extensive documentation for 'detectors_config', including available detectors, their configurations, and example usage. This adds significant meaning beyond the minimal schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Detect sensitive content using Guardrails.' It specifies the verb ('detect') and resource ('sensitive content'), though it doesn't explicitly differentiate from sibling tools like 'use_policy_to_detect' or 'mitigation_guardrails_policy', which appear related. The purpose is clear but lacks sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'use_policy_to_detect' or other sibling tools. It includes an example of how to configure detectors but doesn't explain the context or prerequisites for using this detection method. No explicit when/when-not statements or alternative recommendations are present.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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