rad_sync
Synchronize Radicle repositories with the network by specifying a path, enabling seamless updates and collaboration across decentralized and centralized platforms.
Instructions
Sync a Radicle repository with the network.
Args:
repository_path: Path to the repository (default: current directory)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repository_path | No | . |
Implementation Reference
- src/radicle_mcp/server.py:137-150 (handler)The primary handler for the 'rad_sync' MCP tool. Decorated with @mcp.tool() for automatic registration and schema inference from type hints. Executes 'rad sync' via the run_rad_command helper.@mcp.tool() async def rad_sync(repository_path: str = ".") -> str: """ Sync a Radicle repository with the network. Args: repository_path: Path to the repository (default: current directory) """ result = await run_rad_command(["rad", "sync"], cwd=repository_path) if result["success"]: return f"✅ Successfully synced repository\n{result['stdout']}" else: return f"❌ Failed to sync repository: {result['stderr']}"
- src/radicle_mcp/server.py:37-85 (helper)Shared helper function that runs 'rad' CLI commands asynchronously and returns structured results (stdout, stderr, success). Directly used by rad_sync.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 }