guardrails_scan_pii
Scan text for personally identifiable information (PII) including emails, phone numbers, tax IDs, SSNs, and credit cards. Use it to audit content before logging or sharing to comply with GDPR and LGPD.
Instructions
Scan text for personally identifiable information (PII) across US, international, and Brazilian formats.
Detects 7 PII types: email addresses, US phone numbers, international
phone numbers (E.164-style with country code), Brazilian CPF and CNPJ
tax IDs, US Social Security Numbers, and 16-digit credit card numbers.
Use this to audit content before logging, storing, exporting, or
sharing it — e.g. as a GDPR/LGPD pre-storage check. Deterministic
regex engine; read-only and safe to retry.
Returns a JSON object:
- pii_detected (bool): true if any PII was found.
- findings (list): one object per PII type found, with
"pii_type" (str: "email" | "phone" | "phone_intl" | "cpf" |
"cnpj" | "ssn" | "credit_card"), "count" (int: occurrences), and
"redacted_samples" (list of str: first 3 matches, truncated to 3
leading characters + "***" so no raw PII is echoed back).
Example: guardrails_scan_pii(text="Contact joe@acme.com or
555-123-4567") returns pii_detected true with findings for "email"
(count 1, sample "joe***") and "phone" (count 1, sample "555***").
Billing note: on the hosted ThinkNEO endpoint this call costs 1 TNC;
this open-source build runs free and offline.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to scan for personally identifiable information: user input, chat messages, documents, log lines, or any string that might contain emails, phone numbers, government IDs, or card numbers. Up to 50,000 characters. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |