import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
const NON_FATAL_MCP_ERROR_CODES = new Set([
    ErrorCode.InvalidRequest,
    ErrorCode.MethodNotFound,
    ErrorCode.InvalidParams,
]);
export function shouldResetConnection(error) {
    if (!error) {
        return false;
    }
    if (error instanceof McpError) {
        return !NON_FATAL_MCP_ERROR_CODES.has(error.code);
    }
    return error instanceof Error;
}
//# sourceMappingURL=errors.js.map