def generate_command_docs(
    commands: list[Command],
    subroutine_types,
    **kwargs,
) -> str:
    """Generate detailed command documentation.

    Format includes docstring, signature and argument details.

    Args:
        commands: List of commands to document
        subroutine_types: List of subroutines to document
        **kwargs: Additional format variables for docstrings

    Returns:
        Formatted documentation string
    """
    docs = ""
    for cmd in commands + subroutine_types:
        docs += f"{cmd.name}:\n"
        if cmd.docstring is not None:
            docs += f"  docstring: {cmd.docstring.format(**kwargs)}\n"
        if cmd.signature is not None:
            docs += f"  signature: {cmd.signature}\n"
        else:
            docs += f"  signature: {get_signature(cmd)}\n"
        if cmd.arguments:
            docs += "  arguments:\n"
            for argument in cmd.arguments:
                param = argument.name
                req_string = "required" if argument.required else "optional"
                docs += f"    - {param} ({argument.type}) [{req_string}]: {argument.description}\n"
        docs += "\n"
    return docs
Generate detailed command documentation.

    Format includes docstring, signature and argument details.

    Args:
        commands: List of commands to document
        subroutine_types: List of subroutines to document
        **kwargs: Additional format variables for docstrings

    Returns:
        Formatted documentation string
    
sweagent/tools/utils.py