MCPcopy Create free account
hub / github.com/IBM/mcp-cli / tools_command

Function tools_command

src/mcp_cli/main.py:1059–1105  ·  view source on GitHub ↗

List unique tools across all connected servers.

(
    all: bool = typer.Option(False, "--all", help="Show detailed tool information"),
    raw: bool = typer.Option(False, "--raw", help="Show raw JSON definitions"),
    config_file: str = typer.Option(
        "server_config.json", help="Configuration file path"
    ),
    server: str | None = typer.Option(None, help="Server to connect to"),
    provider: str = typer.Option("openai", help="LLM provider name"),
    model: str | None = typer.Option(None, help="Model name"),
    disable_filesystem: bool = typer.Option(False, help="Disable filesystem access"),
    quiet: bool = typer.Option(False, "-q", "--quiet", help="Suppress most log output"),
    verbose: bool = typer.Option(
        False, "-v", "--verbose", help="Enable verbose logging"
    ),
    log_level: str = typer.Option("WARNING", "--log-level", help="Set log level"),
    theme: str = typer.Option("default", "--theme", help="UI theme"),
)

Source from the content-addressed store, hash-verified

1057# Tools command - create a direct command that wraps the tools functionality
1058@app.command("tools", help="List available tools")
1059def tools_command(
1060 all: bool = typer.Option(False, "--all", help="Show detailed tool information"),
1061 raw: bool = typer.Option(False, "--raw", help="Show raw JSON definitions"),
1062 config_file: str = typer.Option(
1063 "server_config.json", help="Configuration file path"
1064 ),
1065 server: str | None = typer.Option(None, help="Server to connect to"),
1066 provider: str = typer.Option("openai", help="LLM provider name"),
1067 model: str | None = typer.Option(None, help="Model name"),
1068 disable_filesystem: bool = typer.Option(False, help="Disable filesystem access"),
1069 quiet: bool = typer.Option(False, "-q", "--quiet", help="Suppress most log output"),
1070 verbose: bool = typer.Option(
1071 False, "-v", "--verbose", help="Enable verbose logging"
1072 ),
1073 log_level: str = typer.Option("WARNING", "--log-level", help="Set log level"),
1074 theme: str = typer.Option("default", "--theme", help="UI theme"),
1075) -> None:
1076 """List unique tools across all connected servers."""
1077 # Configure logging and theme for this command
1078 _setup_command_logging(quiet, verbose, log_level, theme)
1079
1080 # Process options
1081 servers, _, server_names = process_options(
1082 server, disable_filesystem, provider, model, config_file, quiet=quiet
1083 )
1084
1085 # Use unified command system via CLI adapter
1086 from mcp_cli.adapters.cli import cli_execute
1087
1088 # Execute via run_command_sync with async wrapper
1089 async def _tools_wrapper(**params):
1090 return await cli_execute(
1091 "tools",
1092 details=params.get("all", False),
1093 raw=params.get("raw", False),
1094 )
1095
1096 run_command_sync(
1097 _tools_wrapper,
1098 config_file,
1099 servers,
1100 extra_params={
1101 "all": all,
1102 "raw": raw,
1103 "server_names": server_names,
1104 },
1105 )
1106
1107
1108direct_registered.append("tools")

Callers

nothing calls this directly

Calls 3

process_optionsFunction · 0.90
run_command_syncFunction · 0.90
_setup_command_loggingFunction · 0.85

Tested by

no test coverage detected