@@ -420,19 +420,9 @@ def mcp_server():
420420
421421 all_commands_info = discover_all_commands (cli )
422422
423- @mcp .tool ()
424423 def get_command_info (
425424 command_path : str ,
426425 ) -> Dict [str , Any ]:
427- """
428- Get the parameter schema for any rsconnect command.
429-
430- Returns information about the parameters needed to construct an rsconnect command
431- that can be executed in a bash shell. Supports nested command groups of arbitrary depth.
432-
433- :param command_path: space-separated command path (e.g., 'version', 'deploy notebook', 'content build add')
434- :return: dictionary with command parameter schema and execution metadata
435- """
436426 try :
437427 # split the command path into parts
438428 parts = command_path .strip ().split ()
@@ -482,6 +472,25 @@ def get_command_info(
482472 except Exception as e :
483473 raise ToolError (f"Failed to retrieve command info: { str (e )} " )
484474
475+ # dynamically build docstring with top level commands
476+ # note: excluding mcp-server here
477+ available_commands = sorted (cmd for cmd in all_commands_info ["commands" ].keys () if cmd != "mcp-server" )
478+ commands_list = "\n " .join (f"- { cmd } " for cmd in available_commands )
479+
480+ get_command_info .__doc__ = f"""Get the parameter schema for any rsconnect command.
481+
482+ Returns information about the parameters needed to construct an rsconnect command
483+ that can be executed in a bash shell. Supports nested command groups of arbitrary depth.
484+
485+ Available top-level commands:
486+ { commands_list }
487+
488+ :param command_path: space-separated command path (e.g., 'version', 'deploy notebook', 'content build add')
489+ :return: dictionary with command parameter schema and execution metadata
490+ """
491+
492+ mcp .tool (get_command_info )
493+
485494 mcp .run ()
486495
487496
0 commit comments