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

Method _execute_command

src/mcp_cli/adapters/cli.py:124–143  ·  view source on GitHub ↗

Execute a command with context. Args: command: The unified command to execute. kwargs: Parameters from Typer. Returns: CommandResult from the command execution.

(command: Any, kwargs: dict[str, Any])

Source from the content-addressed store, hash-verified

122
123 @staticmethod
124 async def _execute_command(command: Any, kwargs: dict[str, Any]) -> Any:
125 """
126 Execute a command with context.
127
128 Args:
129 command: The unified command to execute.
130 kwargs: Parameters from Typer.
131
132 Returns:
133 CommandResult from the command execution.
134 """
135 # Add context if needed
136 if command.requires_context:
137 context = get_context()
138 if context:
139 kwargs["tool_manager"] = context.tool_manager
140 kwargs["model_manager"] = context.model_manager
141
142 # Execute the command
143 return await command.execute(**kwargs)
144
145 @staticmethod
146 def create_typer_app() -> typer.Typer:

Calls 2

get_contextFunction · 0.90
executeMethod · 0.45