Show help information for commands.
| 17 | |
| 18 | |
| 19 | class HelpCommand(UnifiedCommand): |
| 20 | """Show help information for commands.""" |
| 21 | |
| 22 | @property |
| 23 | def name(self) -> str: |
| 24 | return "help" |
| 25 | |
| 26 | @property |
| 27 | def aliases(self) -> list[str]: |
| 28 | return ["h", "?"] |
| 29 | |
| 30 | @property |
| 31 | def description(self) -> str: |
| 32 | return "Show help information for commands" |
| 33 | |
| 34 | @property |
| 35 | def help_text(self) -> str: |
| 36 | return """ |
| 37 | Show help information for available commands. |
| 38 | |
| 39 | Usage: |
| 40 | /help [command] - Show help (chat mode) |
| 41 | help [command] - Show help (interactive mode) |
| 42 | mcp-cli help - Show help (CLI mode) |
| 43 | |
| 44 | Examples: |
| 45 | /help - List all commands |
| 46 | /help servers - Show detailed help for servers command |
| 47 | help tools - Show help for tools command |
| 48 | """ |
| 49 | |
| 50 | @property |
| 51 | def parameters(self) -> list[CommandParameter]: |
| 52 | return [ |
| 53 | CommandParameter( |
| 54 | name="command", |
| 55 | type=str, |
| 56 | required=False, |
| 57 | help="Command to get help for", |
| 58 | ), |
| 59 | ] |
| 60 | |
| 61 | @property |
| 62 | def requires_context(self) -> bool: |
| 63 | """Help doesn't need tool manager context.""" |
| 64 | return False |
| 65 | |
| 66 | async def execute(self, **kwargs) -> CommandResult: |
| 67 | """Execute the help command.""" |
| 68 | command_name = kwargs.get("command") or kwargs.get("args") |
| 69 | |
| 70 | # Handle list arguments |
| 71 | if isinstance(command_name, list): |
| 72 | command_name = command_name[0] if command_name else None |
| 73 | |
| 74 | # Get the registry singleton instance |
| 75 | registry = UnifiedCommandRegistry() |
| 76 |
no outgoing calls