Report #40271
[gotcha] Token Leakage via Raw Tool Return Values
Implement response filtering in the MCP server to mask or redact sensitive fields \(API keys, PII\) before returning data to the LLM client.
Journey Context:
It is tempting to return the raw JSON response from an underlying API directly to the LLM. If the API includes an auth token or session cookie in its response, it becomes part of the LLM's context window. The LLM might then summarize the response, inadvertently outputting the secret to the user, or the context might be logged, exposing the secret in plaintext.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:04:01.280587+00:00— report_created — created