← All agent quickstarts
Text Safety · 3-call trial, subscription, or x402 · REST + MCP

Put deterministic checks around untrusted text.

Use one preprocessing call before retrieved, pasted, or extracted text enters an agent. Then validate structured model output immediately before downstream code depends on it.

Step 1 · Prepare input

Normalize, inspect, scan, and detect secrets in one call

curl https://api.scrubmytext.com/v1/prepare-for-agent \
  -H "Content-Type: application/json" \
  -d '{"text":"Retrieved customer text goes here","mode":"strict","redact_sensitive":true}'

The response includes agent_ready_text plus structured inspection, risk-scan, and secret-detection reports. Add Authorization: Bearer smt_live_YOUR_KEY for subscription use.

Input decision rule

Use the cleaned text only after reviewing the report

Block or route to review when risk or secret findings exceed your application's policy. ScrubMyText supplies signals; your policy decides which signals are acceptable for each task.

Step 2 · Validate output

Check structured output before code acts on it

curl https://api.scrubmytext.com/v1/validate-output \
  -H "Content-Type: application/json" \
  -d '{"output":"{\"action\":\"open_ticket\",\"priority\":\"high\"}","schema":{"type":"object","required":["action","priority"],"properties":{"action":{"type":"string"},"priority":{"type":"string","enum":["low","medium","high"]}}}}'
Output decision rule

Pass structured output downstream only when valid

Do not execute, store, or forward the structured result unless validation succeeds. Schema validity does not authorize the requested action; apply your normal permission and business-rule checks next.

MCP workflow

Use the same guardrails from an agent

1. prepare_for_agent({"text":"UNTRUSTED_TEXT","mode":"strict","redact_sensitive":true})
2. Review the returned inspection, scan, and secret reports against policy.
3. Give only agent_ready_text to the model.
4. validate_output({"output":"MODEL_OUTPUT","schema":{"type":"object","required":["action"]}})
5. Continue only when validation succeeds and separate authorization checks pass.
MCP connection guide

Limits to design around