get_user
Retrieve user details by ID from the Devici MCP Server to access specific user information for security management and team coordination.
Instructions
Get a specific user by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes |
Implementation Reference
- src/devici_mcp_server/server.py:27-32 (handler)The MCP tool handler for 'get_user'. This decorated function implements the core logic of the tool by calling the Devici API client to retrieve a specific user by ID and returning the result as a string.@mcp.tool() async def get_user(user_id: str) -> str: """Get a specific user by ID""" async with create_client_from_env() as client: result = await client.get_user(user_id) return str(result)
- Helper method in the API client that performs the actual HTTP request to fetch user data from the Devici API, used by the MCP tool handler.async def get_user(self, user_id: str) -> Dict[str, Any]: """Get specific user by ID.""" return await self._make_request("GET", f"/users/{user_id}")
- src/devici_mcp_server/server.py:27-27 (registration)The @mcp.tool() decorator registers the get_user function as an MCP tool.@mcp.tool()
- Factory function to create the authenticated DeviciAPIClient from environment variables, used in the tool 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)