def METHOD_NAME(self) -> int:
    if not self.pbench_run.exists():
        self.logger.warn("The %s directory does not exist", self.pbench_run)
        return 1
    # list tools in one or all groups
    if self.context.group:
        groups = self.context.group
    else:
        groups = self.groups
    opts = self.context.with_option
    toolname = self.context.name
    found = False
    tool_info = {}
    for group in groups:
        tool_info[group] = {}
        try:
            tg_dir = self.gen_tools_group_dir(group)
        except BadToolGroup:
            self.logger.error("Bad tool group: %s", group)
            return 1
        for path in tg_dir.iterdir():
            # skip __trigger__ if present
            if not path.is_dir():
                continue
            host = path.name
            tool_info[group][host] = {"label": None, "tools": {}}
            toolsdict = tool_info[group][host]["tools"]
            if toolname:
                # Check if the tool is in any of the hosts.
                found = toolname in self.tools(path)
                toolslist = [toolname] if found else []
            else:
                # no tool name was specified
                toolslist = sorted(self.tools(path))
                label = path / "__label__"
                v = label.read_text().rstrip("\n") if label.exists() else None
                tool_info[group][host]["label"] = v
            for tool in toolslist:
                v = (path / tool).read_text().rstrip("\n").split("\n")
                toolsdict[tool] = sorted(v) if opts else ""
    if toolname:
        if found:
            self.print_results(tool_info, self.context.with_option)
            return 0
        else:
            msg = f'Tool "{toolname}" not found in '
            msg += self.context.group[0] if self.context.group else "any group"
            self.logger.error(msg)
            return 1
    elif tool_info:
        found = self.print_results(tool_info, self.context.with_option)
        if not found:
            msg = "No tools found"
            if self.context.group:
                msg += f' in group "{self.context.group[0]}"'
            self.logger.warn(msg)
    else:
        self.logger.warn("No tool groups found")
    return 0