How do I stop AI agents and MCP tools from leaking customer PII?

Keep real values out of the model, check every tool call in both directions, and give real values only to the tools your policy names. Prompts alone will not hold.

SOC 2 Type II · ISO 27001 · HIPAA, BAA available

One tool call, both directions

  • Agent sendsThe model holds tokens

    crm_get_customer(<PERSON>Hq3Vt8Lm</PERSON>)

  • CRM tool receivesResolved for this tool by policy

    crm_get_customer(Tomasz Brennan)

  • Agent gets backMasked before the model

    bill $129 · PIN <PIN_NUMBER>8203</PIN_NUMBER>

Every tool call is checked out and back, and each reveal is logged.

Trusted by regulated enterprises & agentic platforms
Inovalon
Automation Anywhere
Citrix
Bank Of Muscat Logo
Dell

The short answer: check every tool call, outside the model

Treat every tool call as a place data can leave, in both directions, and enforce the rules in code outside the model. A system prompt that says “never reveal PII” is not a control.

01

Keep real values out of the model’s context

Detect PII in prompts, retrieved text and tool results, and replace it with consistent tokens before the model sees it. The model can reason over <PERSON>Hq3Vt8Lm</PERSON>; it cannot repeat a name it never had.

02

Check tool calls in both directions

Whatever the model writes into a tool argument, even a search query, goes to that tool’s server and often its logs. On the way back, a CRM lookup returns the whole record. Mask results before they enter the agent’s context.

03

Resolve real values only for tools your policy names

The CRM lookup needs the real customer. A vendor-hosted search tool does not. Decide per tool, user and task, at the tool boundary, and log each reveal.

04

Scope each MCP server to least privilege

Per-server credentials, narrow scopes, and separate servers for PII-heavy systems, as the OWASP MCP Security Cheat Sheet recommends. Masking limits what a tool sees; scoping limits what it can reach.

05

Keep PII out of memory, logs and handoffs

Agent memory, traces and agent-to-agent messages hold whatever passed through. Store tokens there, not real values.

06

Where Protecto fits

Protecto does steps 1, 2, 3 and 5 in one layer every agent calls. Its agentic detection and classification engine finds 50+ entity types in tool payloads and free text. The Protecto AI Privacy Gateway resolves real values for authorized tool calls automatically, or your team builds its own MCP interception on Protecto Vault APIs. Step 4 stays with your platform team.

Proof

Automation Anywhere uses Protecto to protect customer data in its AI agents, with each enterprise tenant’s own policy

5,000+

Live enterprise tenants protected in Automation Anywhere’s AI agents

50+

Entity types across PII, PHI and PCI, plus custom entities such as your customer ID format

Higher F1

Than AWS Comprehend and Microsoft Presidio in the independent UT Dallas / DataXpert benchmark

Follow one agent run through three tool calls

A support rep asks an internal agent about a customer’s bill. The agent calls two internal MCP tools and one vendor-hosted search tool.

The rep types: “Why is Tomasz Brennan’s bill $40 higher this month, and is there an outage at his address?” The agent can call crm_get_customer on the internal CRM server, outage_check on the internal network server, and web_search on a server run by an outside vendor.

Without data controls, the CRM returns the full record into the model’s context, PIN and a relative’s card number included. The model then writes the customer’s name and home address into a web search, and the vendor receives both. No one attacked anything. The agent did its job with data no one meant to share.

Switch the view to follow the same run with Protecto in the path.

Agent run: Tomasz Brennan’s bill

  1. 1

    Rep’s question to the modelReal name in the context

    Why is Tomasz Brennan’s bill $40 higher this month, and is there an outage at his address?

  2. 2

    Agent calls crm_get_customer (internal)Real name sent

    CRM receives: {"customer": "Tomasz Brennan"}

  3. 3

    CRM record comes back to the agentFull record in the context

    email t.brennan@example.com · phone 555-0177 · born 1984-03-09 · address 418 Alder St, Springfield · PIN 6620 · plan Fiber 500 · bill $129, was $89 · notes: Promo ended Oct 31. Wife Elena Brennan pays with card 4111 1111 1111 4417.

  4. 4

    Agent calls outage_check (internal)Real address sent

    Network server receives: {"address": "418 Alder St, Springfield"}

  5. 5

    Agent calls web_search (outside vendor)Name and address sent to a third party

    Search vendor receives: {"query": "internet outage 418 Alder St Springfield Tomasz Brennan"}

  6. 6

    Trace logs, agent memory, answer to the repEverything above in clear text

    Logs and memory: the full record, PIN and card number included.
    Answer: whatever the model chose to write.

Customer data and tokens are illustrative. Your policy decides which tools get real values; Protecto applies it.

What stays readable either way: the plan, both bill amounts and the promo end date, so the model can still explain the $40. The same customer gets the same token on every call, so the model keeps track of who is who. A masked value can make a lookup fail if it reaches a tool without authorized resolution, which is why the resolve step sits at the tool boundary, not in the model.

How this maps to the OWASP MCP Security Cheat Sheet

OWASP tells you to validate tool inputs and outputs and keep authorization out of the model. It does not say how to keep tools working when values are masked.

OWASP MCP Security Cheat SheetWhat it means for customer PIIWho handles it
Data exfiltration via legitimate channelsKey riskThe model can put PII into a search query, an email subject or any tool argumentProtecto: the model holds tokens, and only tools your policy names get real values
Confused deputyKey riskA tool runs with its own broad access, not the user’sYour platform: per-user identity on tool calls. Protecto applies the user, agent and task your application passes
Least privilegeSection 1Each server reaches only the systems it needsYour platform: scoped credentials per server
Input and output validationSection 5Tool results are untrusted and can carry more data than the task needsProtecto: results are masked before they enter the agent’s context
AuthorizationSection 6Decide in code, not in the promptProtecto: reveal decisions by policy, outside the model
Redact secrets and PII from logsSection 10Traces and tool logs hold whatever passed throughProtecto: logs hold tokens, and each reveal is logged
Prompt injection via tool return valuesSection 12An injected instruction tries to send data somewhere newYour platform: input checks and human approval. Protecto limits what the agent can send, because it holds tokens

OWASP MCP Security Cheat Sheet as of November 8, 2026; OWASP AI Agent Security Cheat Sheet as of October 4, 2026.

Ways to keep PII out of agent tool calls, compared

Each approach scored against the leak at the tool boundary: what goes out, what comes back, and whether the tool still works.

ApproachTool arguments checkedTool results masked before the modelTool still gets the real valueReveal by user, agent and taskBusiness data with no pattern
System prompt rule (“never reveal PII”)NoNoYes, the model holds real valuesNoNo
Output filter or DLP on the final answerNoNoYes, the model holds real valuesNoBasic
Redaction tool the agent callsAn MCP server that redacts on requestOnly when the agent calls itOnly when the agent calls itNo, redacted values do not resolveNoNo
Redaction built into an agent integration platformYesYes, masks fields or refuses the resultNot available for masked fieldsBasicNo
MCP masking proxy with reversible tokensYesYesYesBasic, by group or policyNo
Building it into each agentYour codeYour codeYour codeYour code, per agentCustom logic per case
ProtectoYesYes, including free-text fieldsYes. The Protecto AI Privacy Gateway resolves them automatically, or your code does it with Protecto Vault APIsYes, by the user, agent and task your application passesYes, with Context-Based Access Control (CBAC)

A SaaS company cut cost by 90% compared with building this in-house.

Approaches described from public product documentation, reviewed November 2026.

How Protecto keeps PII out of agent tool calls

Your application or gateway calls Protecto at each point where data moves. Protecto masks, resolves and logs by your policy.

  1. 1

    Mask before the model

    Prompts, retrieved chunks and earlier tool results pass through Protecto. Identifiers become consistent tokens like <PERSON>Hq3Vt8Lm</PERSON>, and the same value gets the same token in any session.

  2. 2

    Resolve at the tool boundary

    When the agent calls a tool your policy names, the Protecto AI Privacy Gateway swaps tokens for real values automatically. Or build your own interception of MCP traffic on Protecto Vault APIs. Other tools receive tokens.

  3. 3

    Mask tool results on the way back

    Structured fields and free text such as notes are checked before the result enters the agent’s context, memory or traces.

  4. 4

    Reveal by role, and log it

    Real values appear in the answer only for the people your policy names; everyone else sees tokens. Logs cover masking and unmasking, and reports show how each policy was enforced.

Who holds what in one agent run
  • The modelTokens only
  • Tools your policy namesReal values, at call time
  • Other tools, such as vendor searchTokens
  • Logs, traces and agent memoryTokens, plus a record of each reveal
  • Your environmentReal values and the token mapping

Call Protecto from LangChain, LlamaIndex or your own code, with any model provider. On-premises, private cloud, air-gapped or SaaS. You still own agent identity, server credentials and approvals for risky actions. Data access control for AI agents →

Questions engineers ask about agents, MCP and PII

Can a system prompt stop an agent from leaking PII?

No. A prompt instruction is advice to the model, and injected text or a long context can override it. Keep real values out of the model’s context and enforce tool rules in code outside the model, as the OWASP MCP Security Cheat Sheet recommends.

Because tools return more than the task needs. A CRM lookup sends back the full record, notes included, and all of it enters the agent’s context, traces and memory. Masking results before they reach the model keeps those copies as tokens.

The real value is resolved at the tool boundary, for tools your policy names. The Protecto AI Privacy Gateway does this for authorized tool calls automatically. Teams that build their own MCP interception do it with Protecto Vault APIs. Tools your policy does not name receive tokens.

Protecto is not a prompt filter or AI firewall, so pair it with OWASP’s injection controls. It limits what an injected instruction can get: the agent holds tokens, and a tool your policy does not name receives tokens, not customer data.

It can when placeholders carry no meaning. Protecto uses consistent, format-preserving tokens, so the same customer keeps the same token across tool calls and the model can still follow the text.

No. Your gateway or identity tools decide who an agent or user is and which servers it can reach. Protecto works on the data itself, using the identity and policy context your application passes in.

See what your tools receive

Bring one agent workflow and its tool list, with test data if you prefer. We will show what each tool receives, what the model sees, and what gets logged.

AI Data Leakage Audit Checklist cover
Checklist

AI Data Leakage Audit Checklist

24 yes or no questions across the six places sensitive data leaks in agentic AI, from model requests to tool calls and agent memory.

By submitting you agree to Protecto’s privacy policy.

New: run any AI model without exposing real values.
See how it works