Skip to content

tools

Class info

🛈 DocStrings

call_tool

call_tool(
    config_path: str = config_file_opt,
    name: str = Argument(help=TOOL_NAME_HELP),
    args: list[str] = Argument(None, help=ARGS_HELP),
    verbose: bool = verbose_opt,
)

Execute a tool with given arguments.

Source code in src/llmling/cli/tools.py
@tools_cli.command("call")
def call_tool(
    config_path: str = config_file_opt,
    name: str = t.Argument(help=TOOL_NAME_HELP),
    args: list[str] = t.Argument(None, help=ARGS_HELP),  # noqa: B008
    verbose: bool = verbose_opt,
):
    """Execute a tool with given arguments."""
    from llmling.config.runtime import RuntimeConfig

    kwargs = dict(arg.split("=", 1) for arg in (args or []))
    with RuntimeConfig.open_sync(config_path) as runtime:
        result = asyncio.run(runtime.execute_tool(name, **kwargs))
        print(result)

list_tools

list_tools(
    config_path: str = config_file_opt,
    output_format: OutputFormat = output_format_opt,
    verbose: bool = verbose_opt,
)

List available tools.

Source code in src/llmling/cli/tools.py
@tools_cli.command("list")
def list_tools(
    config_path: str = config_file_opt,
    output_format: OutputFormat = output_format_opt,
    verbose: bool = verbose_opt,
):
    """List available tools."""
    from llmling.config.runtime import RuntimeConfig

    with RuntimeConfig.open_sync(config_path) as runtime:
        format_output(runtime.get_tools(), output_format)

show_tool

show_tool(
    config_path: str = config_file_opt,
    name: str = Argument(help=TOOL_NAME_HELP),
    output_format: OutputFormat = output_format_opt,
    verbose: bool = verbose_opt,
)

Show tool documentation and schema.

Source code in src/llmling/cli/tools.py
@tools_cli.command("show")
def show_tool(
    config_path: str = config_file_opt,
    name: str = t.Argument(help=TOOL_NAME_HELP),
    output_format: OutputFormat = output_format_opt,
    verbose: bool = verbose_opt,
):
    """Show tool documentation and schema."""
    from llmling.config.runtime import RuntimeConfig

    with RuntimeConfig.open_sync(config_path) as runtime:
        format_output(runtime.get_tool(name), output_format)