Skip to main content
Glama
alberthild

ShieldAPI MCP

shieldapi.check_prompt

Read-onlyIdempotent

Analyze text for prompt injection attacks across 4 categories using 200+ detection patterns before processing untrusted user input.

Instructions

Detect prompt injection in text. Analyzes across 4 categories (direct injection, encoding tricks, exfiltration, indirect injection) with 200+ detection patterns. Designed for real-time inline usage before processing untrusted user input. Returns boolean verdict, confidence score (0-1), matched patterns with evidence, and decoded content if encoding obfuscation was detected. Response time <100ms p95.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesThe text to analyze for prompt injection
contextNoContext hint for sensitivity: user-input (default), skill-prompt (higher tolerance), system-prompt (highest sensitivity)

Implementation Reference

  • The 'shieldapi.check_prompt' tool registration and handler implementation. It uses 'callShieldApiPost' to send the prompt to the ShieldAPI backend.
    server.tool(
      'shieldapi.check_prompt',
      'Detect prompt injection in text. Analyzes across 4 categories (direct injection, encoding tricks, exfiltration, indirect injection) with 200+ detection patterns. Designed for real-time inline usage before processing untrusted user input. Returns boolean verdict, confidence score (0-1), matched patterns with evidence, and decoded content if encoding obfuscation was detected. Response time <100ms p95.',
      {
        prompt: z.string().describe('The text to analyze for prompt injection'),
        context: z.enum(['user-input', 'skill-prompt', 'system-prompt']).optional()
          .describe('Context hint for sensitivity: user-input (default), skill-prompt (higher tolerance), system-prompt (highest sensitivity)'),
      },
      { title: 'Detect Prompt Injection', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
      async (params) => {
        const body: Record<string, unknown> = { prompt: params.prompt };
        if (params.context) body.context = params.context;
        return formatResult(await callShieldApiPost('check-prompt', body));
      }
    );
  • The helper function that communicates with the ShieldAPI backend for the tools.
    async function callShieldApiPost(endpoint: string, body: Record<string, unknown>): Promise<unknown> {
      const url = new URL(`${SHIELDAPI_URL}/api/${endpoint}`);
      if (demoMode) {
        url.searchParams.set('demo', 'true');
      }
    
      const response = await paymentFetch(url.toString(), {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const body = await response.text();
        throw new Error(`ShieldAPI ${endpoint} failed (${response.status}): ${body.substring(0, 200)}`);
      }
      return response.json();
    }
Behavior5/5

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

Substantial disclosure beyond annotations: specifies 4 detection categories, 200+ patterns, detailed return schema (boolean verdict, confidence 0-1, matched patterns, decoded content), and performance SLA (<100ms p95). Annotations cover safety profile (readOnly/idempotent), description covers functional behavior.

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?

Three information-dense sentences with zero waste. Front-loaded with purpose (sentence 1), usage context (sentence 2), and output/performance characteristics (sentence 3). No redundancy with structured fields.

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

Completeness5/5

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

Comprehensive for a detection tool. Compensates for missing output_schema by detailing return structure (boolean, confidence, patterns, decoded content) and performance characteristics. Combined with rich annotations and 100% param coverage, description provides complete invocation context.

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

Parameters3/5

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

Schema coverage is 100% with complete property descriptions. Description references 'text' which aligns with the 'prompt' parameter, but adds no syntax, validation rules, or format details beyond what's already documented in the schema. Baseline 3 appropriate when schema carries full documentation burden.

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

Purpose5/5

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

Opens with specific verb 'Detect' and clear resource 'prompt injection in text'. Distinguishes sharply from siblings (check_domain, check_email, etc.) by specifying text/prompt analysis across 4 unique categories (direct injection, encoding tricks, exfiltration, indirect injection).

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

Usage Guidelines4/5

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

Provides explicit usage context: 'Designed for real-time inline usage before processing untrusted user input.' Gives clear operational guidance (inline, before processing). Lacks explicit 'when not to use' or comparison to siblings, though domain is distinct.

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/alberthild/shield-api-mcp'

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