rad_init
Initialize a new Radicle repository by specifying its name, description, and visibility. Simplifies repository creation for collaborative coding through the Radicle + GitHub MCP Server.
Instructions
Initialize a new Radicle repository.
Args:
name: Name of the repository
description: Description of the repository
public: Whether the repository should be public (default: True)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | ||
| name | Yes | ||
| public | No |
Implementation Reference
- src/radicle_mcp/server.py:87-113 (handler)The primary handler function for the 'rad_init' tool. It is decorated with @mcp.tool() which handles both registration and schema inference from the type hints and docstring. Constructs and executes the 'rad init' command using the helper function.@mcp.tool() async def rad_init(name: str, description: str = "", public: bool = True) -> str: """ Initialize a new Radicle repository. Args: name: Name of the repository description: Description of the repository public: Whether the repository should be public (default: True) """ command = ["rad", "init", "--name", name] if description: command.extend(["--description", description]) if public: command.append("--public") else: command.append("--private") result = await run_rad_command(command) if result["success"]: return f"✅ Successfully initialized Radicle repository '{name}'\n{result['stdout']}" else: return f"❌ Failed to initialize repository: {result['stderr']}"
- src/radicle_mcp/server.py:37-85 (helper)Shared helper utility function used by rad_init and other radicle tools to execute 'rad' CLI commands asynchronously, handling subprocess execution, output capture, and error conditions.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 }