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

Function main

examples/commands/command_system_demo.py:188–355  ·  view source on GitHub ↗

Main demonstration function.

()

Source from the content-addressed store, hash-verified

186
187
188async def main():
189 """Main demonstration function."""
190 output.rule("[bold green]MCP-CLI Command System Demonstration[/bold green]")
191 output.print()
192 output.print(
193 "This script demonstrates all chat commands working with the global context manager."
194 )
195 output.print(
196 "Each command is executed independently without the full MCP-CLI application."
197 )
198 output.print()
199
200 # Set up the context
201 output.info("Setting up application context...")
202 context = await setup_context()
203 output.success(
204 f"Context initialized with provider: {context.provider}, model: {context.model}"
205 )
206 output.print()
207
208 # List registered commands
209 output.info(f"Total registered commands: {len(_COMMAND_HANDLERS)}")
210 output.print(f"Commands: {', '.join(sorted(_COMMAND_HANDLERS.keys()))}")
211 output.print()
212
213 # Demonstrate EVERY registered command
214 output.rule("[bold yellow]Testing ALL Commands[/bold yellow]")
215
216 # === Help Commands ===
217 output.rule("[cyan]Help Commands[/cyan]")
218 await demonstrate_command("/help", "Show help for all commands")
219 await demonstrate_command("/help /servers", "Show help for specific command")
220 await demonstrate_command("/help tools", "Show help for tools group")
221 await demonstrate_command("/help conversation", "Show help for conversation group")
222 await demonstrate_command("/help ui", "Show help for UI group")
223 await demonstrate_command("/qh", "Show quick help reference (alias for quickhelp)")
224
225 # === Server Commands ===
226 output.rule("[cyan]Server Management Commands[/cyan]")
227 await demonstrate_command("/servers", "List all servers")
228 await demonstrate_command("/servers sqlite", "Show specific server details")
229 await demonstrate_command("/servers enable sqlite", "Enable a server")
230 await demonstrate_command("/servers disable filesystem", "Disable a server")
231 await demonstrate_command("/servers config sqlite", "Show server configuration")
232 await demonstrate_command("/servers tools sqlite", "List tools for a server")
233 await demonstrate_command("/servers ping sqlite", "Ping a specific server")
234 await demonstrate_command("/servers test sqlite", "Test a server connection")
235 await demonstrate_command("/servers --detailed", "Show detailed server view")
236
237 # === Tool Commands ===
238 output.rule("[cyan]Tool Management Commands[/cyan]")
239 await demonstrate_command("/tools", "List all available tools")
240 await demonstrate_command("/tools --validate", "List tools with validation")
241 await demonstrate_command("/tools-enable query", "Enable a specific tool")
242 await demonstrate_command("/tools-disable read_file", "Disable a specific tool")
243 await demonstrate_command("/tools-validate", "Validate all tools")
244 await demonstrate_command("/tools-validate query", "Validate specific tool")
245 await demonstrate_command("/tools-status", "Show tool management status")

Callers 1

Calls 3

setup_contextFunction · 0.85
demonstrate_commandFunction · 0.85
successMethod · 0.80

Tested by

no test coverage detected