get_user
Retrieve user profile and statistics from WakaTime to track development activity and coding metrics for productivity analysis.
Instructions
Retrieve the given user.
operationId: get-wakatime-user summary: Retrieve the given user description: Mimics https://wakatime.com/developers#users tags: [wakatime] parameters:
name: user in: path description: User ID to fetch (or 'current') required: true schema: type: string responses: 200: description: OK schema: v1.UserViewModel
Requires ApiKeyAuth: Set header Authorization to your API Key
encoded as Base64 and prefixed with Basic.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user | No | current |
Implementation Reference
- src/mcp_tools/users.py:7-39 (handler)The main handler function for the 'get_user' tool, decorated with @app.tool. Includes input parameter 'user: str', calls wakapi client, and returns UserViewModel. Docstring provides OpenAPI schema.@app.tool async def get_user(user: str = "current") -> UserViewModel: """Retrieve the given user. operationId: get-wakatime-user summary: Retrieve the given user description: Mimics https://wakatime.com/developers#users tags: [wakatime] parameters: - name: user in: path description: User ID to fetch (or 'current') required: true schema: type: string responses: 200: description: OK schema: v1.UserViewModel Requires ApiKeyAuth: Set header `Authorization` to your API Key encoded as Base64 and prefixed with `Basic`. """ from mcp_tools.dependency_injection import get_wakapi_client client = get_wakapi_client() try: user_model: UserViewModel = await client.get_user(user=user) return user_model except Exception as e: raise ValueError(f"Failed to fetch user: {e}") from e
- main.py:139-141 (registration)Explicit import of get_user in initialize_tools() to trigger @app.tool registration.from mcp_tools.users import get_user _ = get_user # Trigger registration
- Helper function used by get_user to obtain the WakapiClient instance via dependency injection.def get_wakapi_client() -> WakapiClient: """Get global Wakapi client.""" return _injector.get_wakapi_client()