Rejects an MCP-over-ACP request because of its sessionId: the request has
none and the server needs one, or the server's own check refuses the one it
has.
A McpRequestHandler can also throw it, before doing any of the
request's work, with the same result. It has to reach the provider: the MCP
SDK catches what a tool throws, so an McpSessionError thrown inside a tool
registered through fromMcpServer becomes an ordinary tool error result.
Rejects an MCP-over-ACP request because of its
sessionId: the request has none and the server needs one, or the server's own check refuses the one it has.Throw it from a server's McpServerOptions.admit check, where McpAdmissionRequest.requireSession and McpAdmissionRequest.rejectSession throw it for you. The caller gets an outer ACP
-32602(Invalid params) with this error's message. It is not an inner MCP error, and not a binding failure (-33002).A McpRequestHandler can also throw it, before doing any of the request's work, with the same result. It has to reach the provider: the MCP SDK catches what a tool throws, so an
McpSessionErrorthrown inside a tool registered throughfromMcpServerbecomes an ordinary tool error result.