Skip to main content
Glama

Validate a prompt for injection attacks

validate_prompt
Read-onlyIdempotent

Check a single piece of untrusted text (a user message, a retrieved RAG document, tool output, etc.) for prompt injection, jailbreaks, instruction-override, data-exfiltration, and code injection BEFORE passing it to an LLM. Returns a safe/unsafe verdict with confidence, threat category, and reasoning.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "prompt": "<prompt>"
    },
    "name": "validate_prompt"
  }
}

Input Schema

NameRequiredDescriptionDefault
promptYesThe untrusted text to validate.
sensitivityNoOptional. Omit to use the account default. 'no_judgement' blocks only clear attacks, for apps whose users tell the AI exactly what to write. 'balanced' is an older name for it. 'strict' and 'lenient' are accepted for existing callers.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint=false and destructiveHint=false, so the safety profile is covered. The description contributes the return shape (verdict, confidence, category, reasoning), which matters because there is no output schema, but it says nothing about latency, failure modes, or what happens on oversized/near-limit input.

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?

Two dense sentences with zero filler: the first covers what it checks and when, the second covers the return value. Nothing is buried and nothing repeats the name or title.

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 a low-complexity, two-parameter, annotation-rich tool with no output schema, the description covers purpose, timing, inputs, and outputs. The only material gap is routing to the sibling validate_prompts for multi-text calls.

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 description coverage is 100% and the sensitivity enum carries its own per-value guidance, so the schema already does this work. The description adds no parameter-level detail beyond the threat taxonomy, so the baseline 3 applies.

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?

States a specific verb (check/validate) and a precisely scoped resource ('a single piece of untrusted text'), then enumerates the exact threat classes it detects. The word 'single' implicitly separates it from the plural sibling validate_prompts, and the 'BEFORE passing it to an LLM' clause pins down the lifecycle position.

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?

Clearly says when to call it (before feeding text to the model) and gives concrete input examples: user message, RAG document, tool output. It never names the sibling validate_prompts, so an agent scanning both tools is not explicitly told to use the batch variant for multiple texts.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources