invite_user
Add new users to Devici's threat modeling platform by providing their email, name, and assigned role for access management.
Instructions
Invite a new user to Devici
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | |||
| first_name | Yes | ||
| last_name | Yes | ||
| role | Yes |
Implementation Reference
- src/devici_mcp_server/server.py:43-48 (handler)MCP tool handler and registration for 'invite_user'. Decorated with @mcp.tool(), executes by calling the API client method.@mcp.tool() async def invite_user(email: str, first_name: str, last_name: str, role: str) -> str: """Invite a new user to Devici""" async with create_client_from_env() as client: result = await client.invite_user(email, first_name, last_name, role) return str(result)
- API client helper method that performs the actual HTTP POST request to invite a user via the Devici API.async def invite_user(self, email: str, first_name: str, last_name: str, role: str) -> Dict[str, Any]: """Invite specific user.""" user_data = { "email": email, "firstName": first_name, "lastName": last_name, "role": role } return await self._make_request("POST", "/users/invite", json_data=user_data)
- Factory function to create the authenticated API client from environment variables, used by the handler.def create_client_from_env() -> DeviciAPIClient: """Create API client from environment variables.""" config = DeviciConfig( api_base_url=os.getenv("DEVICI_API_BASE_URL", "https://api.devici.com/api/v1"), client_id=os.getenv("DEVICI_CLIENT_ID", ""), client_secret=os.getenv("DEVICI_CLIENT_SECRET", ""), debug=os.getenv("DEBUG", "false").lower() == "true" ) if not config.client_id or not config.client_secret: raise ValueError("DEVICI_CLIENT_ID and DEVICI_CLIENT_SECRET must be set") return DeviciAPIClient(config)