A tool that fails safely and a tool that fails usefully are not the same thing, and MCP makes it easy to confuse them. The protocol’s answer to a failed operation is a normal result with isError: true and a message in the content — see how MCP tool errors are supposed to work for the mechanism itself. What that mechanism doesn’t do is tell you what belongs in the message. Plenty of servers just forward whatever the underlying exception says, and an exception from a real system tends to say more than anyone intended.

The result object doesn’t care what’s inside it

From the protocol’s point of view, an error message is just a string in a content block, the same shape as any successful result. Nothing in the spec checks it, trims it, or flags it as sensitive. If a server’s error handler is catch (e) => return isError(e.message), whatever the language runtime or the underlying client library put into that exception goes straight into the model’s context, unfiltered, every time something upstream goes wrong. That’s a classic, decades-old category — information exposure through an error message, CWE-209 — showing up in a channel that didn’t exist when the category was named.

What actually ends up in there

The specifics depend on the stack, but the pattern repeats across almost every language and framework:

  • Stack traces naming internal file paths, function names, and the exact library versions a server is running — a map of the codebase for anyone trying to find a known vulnerability in one of those versions.
  • Database errors that quote the failing query, a table or column name that was never meant to be public, or a connection string fragment — the same category of secret covered in MCP secret exposure, just surfacing at runtime instead of sitting in a config file.
  • Internal hostnames and IPs from an upstream service the tool called on the server’s behalf — infrastructure detail no external caller should ever see, let alone a model that might repeat it back in conversation.
  • Environment and config details: an unset variable named in the error, a feature-flag name, a third-party API’s own error payload passed straight through with its account identifiers intact.

The probing angle: bad input as reconnaissance

None of this requires a model to be tricked into anything. An attacker who can influence a tool’s arguments — directly, or through an injected instruction the model picked up elsewhere — can deliberately send malformed, out-of-range, or unexpected input specifically to trigger a verbose failure, the same way a web app pentester fuzzes a login form to see what the error page gives up. A URL-fetching tool is a sharp version of this: point it at an internal service that refuses the connection, and the error it returns — a timeout versus a connection-refused versus a TLS handshake failure — can be enough to start mapping what’s actually reachable behind that server, one failed request at a time.

Where the detail belongs instead

MCP already has a channel built for exactly this kind of free-text diagnostic detail, and it isn’t the tool result: the logging utility, a one-way notifications/message stream a server can push on the side. Most clients people actually use today have no UI for that stream at all, which is a real downside for debugging — but it also means detail sent there doesn’t land in the model’s context by default the way a tool result’s content always does. The practical split: a short, specific, user-facing message in the isError result (“the upstream service didn’t respond in time”), and the full exception — trace, query, hostnames and all — kept server-side, in a real log, or in a logging message for a developer who’s actually watching.

Where gate fits: gate doesn’t inspect or rewrite the content of a tool’s response — response-side filtering is on the roadmap, not in the product today, and we’d rather say that plainly than overclaim it. What gate does today is control which tools can run at all: every tool on every connected server sits behind an allow, ask, or block rule, and every call is logged with its outcome— allowed, blocked, or errored. A tool you know leaks verbose errors can simply be blocked for the roles that don’t need it, and a tool that’s erroring far more than it should shows up as a pattern in the log instead of quietly leaking detail call after call. See /mcp-gateway for the full picture, or scan a server before connecting it.

The bottom line

An MCP error message is just a string nobody validates, and a model’s context is not a safe place to put a stack trace, a database error, or an internal hostname. Catch the real exception where it happens, keep its detail in a server-side log or a logging notification, and hand the model only what it needs to decide what to try next. The fix costs one line in a catch block. The leak, left unfixed, costs whatever that stack trace was willing to give away.