Skip to main content
Glama
mcp-ml-tools
by adeoluo

Scan text for prompt injection and PII

prompt_injection_scan
Read-onlyIdempotent

Scans untrusted text for prompt-injection phrasing, exfiltration patterns, hidden characters, secrets, and PII, returning character spans, a 0-1 risk score, and an optional redacted copy.

Instructions

Rule-based scan of untrusted text (retrieved documents, tool output, user input) for prompt-injection phrasing, exfiltration patterns, hidden characters, secrets, and personal information. Returns findings with character spans, a 0 to 1 risk score, and optionally a redacted copy of the text.

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": {
      "text": "<text>"
    },
    "name": "prompt_injection_scan"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesText to scan
redactNoReturn redactedText with PII and secrets replaced
categoriesNoCategories to check (default: all)
maxFindingsNoMaximum findings (default 200)

Output Schema

NameRequiredDescriptionDefault
notesYes
findingsYes
riskLevelYes
riskScoreYes
findingCountYes
redactedTextNo
categoryScoresYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.2

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and closed-world, so safety is covered. The description adds genuinely new behavioral context beyond that: the scan is rule-based (implying deterministic heuristics rather than semantic judgment), and it discloses the output artifacts including the risk score scale and optional redaction. It does not mention text-size limits or false-positive/negative caveats, which would have pushed this higher.

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?

A single tightly packed sentence, front-loaded with the method ('Rule-based scan') and the input scope before listing detections and outputs. No filler clauses and nothing redundant with the title or schema.

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?

With an output schema present, the description needn't define return values, and it still sketches them. It covers what is scanned, what is detected, and what comes back, which is sufficient for a 4-parameter read-only tool. Minor omissions like how the 0-1 risk score is calibrated or how findings are ordered keep it short of complete.

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%, so text, redact, categories, and maxFindings are all documented in the schema itself, establishing a baseline of 3. The description restates that redaction replaces PII and secrets and that redacted output is optional, but adds no syntax, defaults, or tradeoff information beyond what the schema already provides.

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 pairs the specific verb 'scan' with a precise resource ('untrusted text') and enumerates exactly what it looks for: injection phrasing, exfiltration patterns, hidden characters, secrets, and PII. It also names the return artifacts (character spans, 0-1 risk score, optional redacted copy). It does not reference any sibling, though the sibling set (bm25_search, json_schema_validate, tokenize) is functionally distant enough that confusion is unlikely.

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?

It gives concrete usage context by naming the input sources this is meant for: retrieved documents, tool output, and user input. That tells an agent when the tool applies without stating any exclusions or when-not conditions, which matches the 4 anchor of 'clear context, no exclusions.'

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