diff --git a/src/cai/cli.py b/src/cai/cli.py index e1733af4..3c061601 100644 --- a/src/cai/cli.py +++ b/src/cai/cli.py @@ -1290,7 +1290,7 @@ def run_cai_cli( # If command wasn't recognized, show error (skip for /shell or /s) if command not in ("/shell", "/s"): - console.print(f"[red]Unknown command: {command}[/red]") + console.print(f"[red]Command failed or unknown: {command}[/red]") continue from rich.text import Text diff --git a/src/cai/repl/commands/mcp.py b/src/cai/repl/commands/mcp.py index 57059ba1..a2dc6884 100644 --- a/src/cai/repl/commands/mcp.py +++ b/src/cai/repl/commands/mcp.py @@ -116,11 +116,11 @@ class GlobalMCPUtil(MCPUtil): elif isinstance(server, MCPServerStdio): server_config["command"] = server.params.command server_config["args"] = server.params.args - server_config["env"] = server.params.get("env") - server_config["cwd"] = server.params.get("cwd") - server_config["encoding"] = server.params.get("encoding", "utf-8") - server_config["encoding_error_handler"] = server.params.get( - "encoding_error_handler", "strict" + server_config["env"] = getattr(server.params, "env") + server_config["cwd"] = getattr(server.params, "cwd") + server_config["encoding"] = getattr(server.params, "encoding", "utf-8") + server_config["encoding_error_handler"] = getattr( + server.params, "encoding_error_handler", "strict" ) # Create a custom invoke function that creates a new connection each time @@ -810,9 +810,9 @@ Example: `/mcp add burp 13` # Get the agent try: - agent = get_agent_by_name(agent_identifier) + agent = get_available_agents()[agent_identifier] agent_display_name = getattr(agent, "name", agent_identifier) - except ValueError: + except KeyError: # Try by index try: agents = get_available_agents()