create_user
Admin-only tool to create user accounts with specific roles and permissions. Utilizes user data including email, name, and role for account setup on the MCP Server for Coroot.
Instructions
Create a new user (admin only).
Creates a new user account with specified role and permissions. Requires admin privileges.
Args: user_data: New user information including email, name, role
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_data | Yes |
Implementation Reference
- src/mcp_coroot/server.py:1646-1656 (handler)MCP tool handler function for 'create_user', registered via @mcp.tool() decorator. Delegates to the implementation wrapper.@mcp.tool() async def create_user(user_data: dict[str, Any]) -> dict[str, Any]: """Create a new user (admin only). Creates a new user account with specified role and permissions. Requires admin privileges. Args: user_data: New user information including email, name, role """ return await create_user_impl(user_data) # type: ignore[no-any-return]
- src/mcp_coroot/server.py:1635-1644 (helper)Implementation wrapper that calls CorootClient.create_user and formats the response with success/error handling.@handle_errors async def create_user_impl(user_data: dict[str, Any]) -> dict[str, Any]: """Create a new user.""" result = await get_client().create_user(user_data) return { "success": True, "message": "User created successfully", "user": result, }
- src/mcp_coroot/client.py:1283-1306 (helper)Core API client method that performs the HTTP POST request to Coroot's /api/users endpoint to create a new user account.async def create_user(self, user_data: dict[str, Any]) -> dict[str, Any]: """Create a new user (admin only). Args: user_data: New user data with fields: - email: User email - name: Display name - role: Admin|Editor|Viewer - password: Initial password Returns: Created user. """ # Add action field required by Coroot request_data = {"action": "create", **user_data} response = await self._request( "POST", "/api/users", json=request_data, ) data: dict[str, Any] = response.json() return data