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

Method execute

src/mcp_cli/commands/apps/apps.py:56–85  ·  view source on GitHub ↗

Execute the apps command.

(self, **kwargs)

Source from the content-addressed store, hash-verified

54 ]
55
56 async def execute(self, **kwargs) -> CommandResult:
57 """Execute the apps command."""
58 from mcp_cli.context import get_context
59
60 try:
61 context = get_context()
62 if not context or not context.tool_manager:
63 return CommandResult(
64 success=False,
65 error="No tool manager available. Please connect to a server first.",
66 )
67
68 # Parse subcommand from args or subcommand parameter
69 subcommand = kwargs.get("subcommand", "list")
70 args = kwargs.get("args", "")
71 if args:
72 subcommand = args.strip().split()[0] if args.strip() else "list"
73
74 if subcommand == "running":
75 return await self._show_running(context.tool_manager)
76 elif subcommand == "stop":
77 return await self._stop_all(context.tool_manager)
78 else:
79 return await self._list_app_tools(context.tool_manager)
80
81 except Exception as e:
82 return CommandResult(
83 success=False,
84 error=f"Failed to execute apps command: {e}",
85 )
86
87 async def _list_app_tools(self, tool_manager) -> CommandResult:
88 """List all tools that have MCP Apps interactive UIs."""

Callers

nothing calls this directly

Calls 6

_show_runningMethod · 0.95
_stop_allMethod · 0.95
_list_app_toolsMethod · 0.95
get_contextFunction · 0.90
CommandResultClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected