Skip to main content
Glama

airlock_scrub_text

Sanitizes in-memory text by replacing secrets and PII with reversible <ENTITY_N> placeholders. Use fast regex rules for logs and code, or enable NER to redact names, organizations, and locations.

Instructions

Sanitize in-memory text with reversible <ENTITY_N> placeholders using fast or full detection.

Purpose & Behavior:
Scans `text` for sensitive values, stores original values in the session vault, and replaces them with
`<ENTITY_N>` tokens (e.g., `<API_KEY_1>`). By default (`use_ner=False`), runs deterministic regex and
key-value rules in ~0.2ms for high-speed log/code scrubbing. With `use_ner=True`, also runs the local
ONNX GLiNER model to redact unstructured `PERSON`, `ORGANIZATION`, and `LOCATION` entities.

When to Use:
- Use `airlock_scrub_text(text, use_ner=False)` for fast sub-millisecond scrubbing of terminal logs,
  stack traces, or code snippets where credential/token/email/IP redaction is enough.
- Use `airlock_dehydrate(text)` (or `airlock_scrub_text(text, use_ner=True)`) for natural-language
  prompts or documents that also contain human names, organizations, or locations.
- Use `airlock_read_file` instead when the text lives in a file on disk.

Returns:
A JSON-serializable object with `{"sanitized_text": str, "redacted_count": int, "latency_ms": float,
"tokens": list[str]}` listing the generated `<ENTITY_N>` placeholders.

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": "airlock_scrub_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesRaw in-memory text, log output, or code snippet to sanitize by replacing detected secrets and PII with reversible <ENTITY_N> placeholders.
use_nerNoWhen False (default), runs fast deterministic regex and key-value heuristics only (~0.2ms) to catch API keys, tokens, passwords, emails, and IPs. Set to True to also run the ONNX GLiNER neural model (~55ms) for contextual person, organization, and location names.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.4.6
    • addedInput schema / properties / text / description
      Added value: +"Raw in-memory text, log output, or code snippet to sanitize by replacing detected secrets and PII with reversible <ENTITY_N> placeholders."
    • changedInput schema / properties / use_ner / default
      Previous value: -trueNew value: +false
    • addedInput schema / properties / use_ner / description
      Added value: +"When False (default), runs fast deterministic regex and key-value heuristics only (~0.2ms) to catch API keys, tokens, passwords, emails, and IPs. Set to True to also run the ONNX GLiNER neural model (~55ms) for contextual person, organization, and location names."
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond annotations (readOnlyHint=false, idempotentHint=false, destructiveHint=false), the description discloses the side effect that justifies them: originals are persisted in the session vault, so the call mutates state and is recoverable. It also quantifies performance (~0.2ms regex vs. ~55ms ONNX) and names the specific entity types each mode covers, which the annotations cannot express.

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

Conciseness4/5

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

Headings ('Purpose & Behavior', 'When to Use', 'Returns') front-load the decision-relevant information, and every sentence carries routing or behavioral content. It is slightly longer than needed for a two-parameter tool, and the latency figures are repeated across the description and the schema.

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?

For a two-parameter read-and-replace utility, the definition covers purpose, mode selection, side effects (vault storage), and the exact return keys including tokens. No output schema exists, and the description compensates by enumerating the four returned fields.

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?

Schema coverage is 100%, so the baseline is 3; the description earns an extra point by tying use_ner to concrete latency and to the exact entity classes (PERSON/ORGANIZATION/LOCATION) added, and by framing text as in-memory input. Most of this overlaps the schema's own parameter text, so it is enrichment rather than new semantics.

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?

The first sentence names a specific verb and resource ('sanitize in-memory text') plus the mechanism ('reversible <ENTITY_N> placeholders'), and the body contrasts it with airlock_dehydrate and airlock_read_file. An agent can distinguish this from every listed sibling without opening a schema.

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

Usage Guidelines5/5

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

The 'When to Use' block gives explicit routing rules: use_ner=False for logs/stack traces/code, airlock_dehydrate or use_ner=True for natural-language documents with names/orgs/locations, and airlock_read_file when the text is on disk. Both the positive conditions and the alternatives are named.

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