Skip to main content
Glama
LuciferForge

agent-safety-mcp

by LuciferForge

injection_check

Scan text for injection attempts and block content based on configurable severity thresholds to enhance security in AI agent interactions.

Instructions

Scan text and block if injection is detected above threshold.

Args: text: The text to check for injection attempts. threshold: Block at this severity or above — "LOW", "MEDIUM", "HIGH", "CRITICAL".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
thresholdNoMEDIUM

Implementation Reference

  • The handler function 'injection_check' that executes the scan using PromptScanner and returns the result or error info.
    def injection_check(text: str, threshold: str = "MEDIUM") -> dict:
        """Scan text and block if injection is detected above threshold.
    
        Args:
            text: The text to check for injection attempts.
            threshold: Block at this severity or above — "LOW", "MEDIUM", "HIGH", "CRITICAL".
        """
        scanner = PromptScanner(threshold=threshold)
        try:
            result = scanner.check(text)
            return {
                "allowed": True,
                "severity": result.severity,
                "risk_score": result.risk_score,
            }
        except InjectionRiskError as e:
            return {
                "allowed": False,
                "severity": e.severity,
                "risk_score": e.risk_score,
                "matches": e.matches,
                "text_preview": e.text[:200],
            }
  • The @mcp.tool() decorator used to register the injection_check function as an MCP tool.
    @mcp.tool()
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the blocking side-effect and enumerates the severity scale ('LOW' through 'CRITICAL'), but omits critical behavioral details: the type of injection detected (prompt injection, SQL, etc.), the return value format on pass/fail, and whether blocking throws an exception or returns a status object.

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

Conciseness5/5

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

The description is efficiently structured with a single purpose statement followed by a clear Args section. There is no redundant text, and every sentence provides necessary information not found in the structured fields.

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

Completeness3/5

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

For a tool with no output schema and no annotations, the description adequately covers the input parameters but leaves a significant gap regarding the return behavior. Since this is a security gate that 'blocks', specifying whether it returns a boolean, a detailed object, or raises an exception is necessary for correct agent invocation.

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

Parameters4/5

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

The Args section effectively compensates for the 0% schema description coverage by documenting both parameters: 'text' is defined as the input to check, and 'threshold' includes the valid severity strings. It loses a point for failing to mention the default value 'MEDIUM' specified in the schema, which is essential for optional parameter usage.

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 scans text and blocks based on a severity threshold, using specific verbs ('scan', 'block') and identifying the resource ('text'). However, it fails to differentiate from the sibling tool 'injection_scan', leaving ambiguity about when to use this blocking variant versus the scanning alternative.

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?

There is no explicit guidance on when to use this tool versus alternatives like 'injection_scan' or 'safety_check'. The description implies usage through the word 'block' but does not specify prerequisites, when-not-to-use conditions, or comparative scenarios with sibling tools.

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

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/LuciferForge/agent-safety-mcp'

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