set
Execute management commands to configure and control OpenSimulator virtual world servers, including setting parameters, changing regions, restarting services, and saving data.
Instructions
Run a mutating/management command (set/change/restart/save/etc.).
Examples:
set log level debug
change region MyRegion
region restart notice "Restarting" 60
save oar region.oar
terrain load myterrain.r32
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | ||
| args | No |
Implementation Reference
- opensim_mcp/server.py:117-129 (handler)The handler function for the 'set' tool. Decorated with @mcp.tool() for registration. Takes a base command and optional args, builds the full command, and sends it to the OpenSimulator console via the global console client.@mcp.tool() async def set(command: str, args: str = "") -> str: """ Run a mutating/management command (set/change/restart/save/etc.). Examples: - set log level debug - change region MyRegion - region restart notice \"Restarting\" 60 - save oar region.oar - terrain load myterrain.r32 """ return await console.send_command(_build_command(command, args))
- opensim_mcp/server.py:96-100 (helper)Helper function used by 'set' (and 'get') tools to construct the full console command from base command and args.def _build_command(base: str, args: str = "") -> str: base = base.strip() args = args.strip() return f"{base} {args}".strip()
- opensim_mcp/server.py:61-82 (helper)Core helper method in OpenSimConsole class that sends a command to the OpenSimulator REST console, manages session, and retrieves the response. Called by the 'set' tool.async def send_command(self, command: str) -> str: if not self.session_id: await self.start_session() async with await self._get_client() as client: response = await client.post( f"{self.base_url}/SessionCommand/", data={"ID": self.session_id, "COMMAND": command}, ) if response.status_code != 200: raise Exception( f"Command failed: {response.status_code} - {response.text}" ) # Wait for command to be processed before reading response await asyncio.sleep(0.3) read_response = await client.post( f"{self.base_url}/ReadResponses/{self.session_id}/" ) return read_response.text
- opensim_mcp/server.py:117-117 (registration)The @mcp.tool() decorator registers the 'set' function as an MCP tool.@mcp.tool()