Skip to content

Typed session errors leak the "MCP error -32600:" prefix into tool result error fields #647

Description

@debugmcpdev

Found while live-probing #638. A step_over on a session whose proxy is gone returns:

{"success": false, "error": "MCP error -32600: Cannot step over: no active proxy for session <id>"}

The MCP error -32600: prefix is protocol plumbing leaking into an application-level payload. It happens because the typed session errors (SessionNotFoundError, SessionTerminatedError, ProxyNotRunningErrorsrc/errors/debug-errors.ts) extend McpError, whose constructor bakes MCP error <code>: into .message, and sessionErrorToResult (src/server/tool-result.ts:56) copies error.message into the envelope verbatim.

Every handler family that catches typed session errors emits the prefix, so an agent reading error gets a string that half-looks like a transport failure. The clean message is recoverable — the subclasses carry their own fields (sessionId, operation, state), or sessionErrorToResult could strip the known prefix pattern.

Scoped out of the #638 PR deliberately: it is cross-cutting (many handlers, many pinned test strings), and worth doing once, everywhere, rather than as a rider on a step-tools fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions