An agent can have a legitimate reason to read sensitive material and an illegitimate way to pass it on. A support workflow may read a customer record to answer one question, then send a broad account summary to a search connector “for context.” A coding agent may read a local configuration file and paste its contents into an issue, a shell command, or a remote analysis tool. Nothing has to look like an obvious attack: a model can simply include more context than the task needs.
The practical move is to put an egress gate between the model’s proposed tool arguments and the external destination. The gate classifies the destination and the fields in the proposed payload, constructs a minimum allowed payload in trusted code, and stops anything that needs a different recipient, a broader data class, or a new approval. The model may request an operation; it should not decide which sensitive context gets exported with it.
OpenAI warns that an agent can accidentally share private data and may send more data to an MCP than the user expected; it also says that untrusted data can drive downstream tool calls.[1] OWASP lists PII, financial details, credentials, legal documents, and confidential business data among sensitive information that can be exposed through an LLM application.[2] MCP’s tool specification makes the execution boundary concrete: clients should show tool inputs for sensitive operations to avoid accidental or malicious data exfiltration, while servers must validate inputs and enforce access controls.[3] Together, those sources support a narrow design rule: treat outbound tool arguments as a policy-enforced data transfer, not as harmless model text.
Separate useful context from permitted disclosure
Start with the destination, not the model’s explanation. A local formatter, an internal ticket queue, a customer-facing email sender, and a third-party research connector are different recipients with different policies. Give each destination a stable ID, trust tier, allowed operations, and an explicit list of data classes it may receive.
Then label data at the application boundary. Useful classes might include public, internal, customer_content, customer_identifier, financial, credential, and regulated. The labels should come from records, fields, or deterministic detectors—not from a model deciding that a token “probably is not secret.” A field can be useful to the agent while still being forbidden to a particular tool.
The gate should use that policy to build a new payload. It should not merely scan the model’s JSON and approve it if no obvious bad word appears. For example, a research connector might receive a redacted product error message and product version, but never an API key, customer email, account ID, or raw support transcript. An internal ticket may receive a customer ID and a bounded summary, but not a payment instrument or credentials.
Copy this egress-gate contract
Put this code-owned contract immediately before any networked connector, browser submission, email sender, issue tracker, analytics endpoint, or external model call.
PROPOSED BY THE AGENT
- destination_id: [one registered tool/service]
- operation: [one allowlisted verb]
- purpose: [short task-bound reason]
- requested_fields: [named fields, never an arbitrary context blob]
- target_scope: [tenant/project/record IDs]
TRUSTED EGRESS GATE
1. Resolve destination_id to its registered trust tier and data policy.
2. Verify operation, target scope, and current authorization are allowed.
3. Fetch requested fields only from the authorized source of truth.
4. Classify every field: public | internal | customer_content |
customer_identifier | financial | credential | regulated.
5. Intersect the requested fields with the destination’s field allowlist.
6. Apply required transforms: redact, tokenize, summarize in a bounded schema,
aggregate, or replace with a stable internal reference.
7. Reject any credential, unclassified field, cross-tenant value, or field not
explicitly allowed for this destination and operation.
8. Require fresh approval when the destination, data class, or effect differs.
RETURN TO EXECUTOR
{destination_id, operation, allowed_payload_digest, removed_fields,
policy_version, approval_ref, egress_receipt_id}
Make the safe alternative usable
A gate that only returns denied encourages workarounds. Give it constrained substitutes. Replace an email address with a case-specific opaque ID for an internal service. Replace a full document with extracted fields whose schema matches the destination’s job. Replace a raw error report with an approved, redacted diagnostic packet. If no safe minimum payload can serve the task, return needs_approval or destination_not_allowed rather than silently widening access.
Failure mode: redaction mistaken for authorization
Masking a few patterns is useful, but it cannot prove that the remaining text is safe to share. A customer narrative can reveal identity without an email address; a local file can contain a secret in an unfamiliar format; a summary can preserve details a destination never needed. Conversely, a blanket ban on all customer data can make safe internal workflows impossible.
Use destination-specific allowlists and minimum payloads first; use redaction as a secondary transformation. Test the gate with a permitted internal handoff, a third-party lookup that asks for more context, a credential hidden in free text, a cross-tenant record, and an unclassified new field. The correct result is often a useful, smaller payload—or a visible stop—not a model’s confident assurance that sharing is fine.
The habit to keep
when an agent calls an external tool, send the smallest policy-approved data object that can do that one job. Let trusted code choose the payload; let the model explain why it wants it.