rad_help
Access detailed help for Radicle commands to streamline peer-to-peer code collaboration and repository management. Optional: Specify a command for targeted assistance.
Instructions
Get help for Radicle commands.
Args:
command: Specific command to get help for (optional)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | No |
Implementation Reference
- src/radicle_mcp/server.py:255-272 (handler)The main handler function for the 'rad_help' tool. Registered via @mcp.tool() decorator. Provides help for Radicle CLI commands by executing 'rad --help' or 'rad <command> --help' using the run_rad_command helper. Includes input schema in docstring.@mcp.tool() async def rad_help(command: Optional[str] = None) -> str: """ Get help for Radicle commands. Args: command: Specific command to get help for (optional) """ if command: result = await run_rad_command(["rad", command, "--help"]) else: result = await run_rad_command(["rad", "--help"]) if result["success"]: return f"📖 Radicle Help:\n{result['stdout']}" else: return f"❌ Failed to get help: {result['stderr']}"
- src/radicle_mcp/server.py:37-85 (helper)Helper utility function used by rad_help (and other tools) to execute Radicle CLI commands asynchronously via subprocess, returning structured results.async def run_rad_command(command: List[str], cwd: Optional[str] = None) -> Dict[str, Any]: """ Run a rad command and return the result. Args: command: List of command arguments starting with 'rad' cwd: Working directory to run the command in Returns: Dictionary with stdout, stderr, and return_code """ try: # Ensure command starts with 'rad' if not command or command[0] != "rad": command = ["rad"] + command logger.info(f"Running command: {' '.join(command)}") process = await asyncio.create_subprocess_exec( *command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, cwd=cwd ) stdout, stderr = await process.communicate() return { "stdout": stdout.decode("utf-8").strip(), "stderr": stderr.decode("utf-8").strip(), "return_code": process.returncode, "success": process.returncode == 0 } except FileNotFoundError: return { "stdout": "", "stderr": "rad command not found. Please ensure Radicle is installed.", "return_code": 127, "success": False } except Exception as e: return { "stdout": "", "stderr": f"Error running command: {str(e)}", "return_code": 1, "success": False }