get_projects
Retrieve and filter development projects from WakaTime to analyze coding activity and track project-specific time investments.
Instructions
Retrieve and filter the user's projects.
operationId: get-wakatime-projects summary: Retrieve and filter the user's projects description: Mimics https://wakatime.com/developers#projects tags: [wakatime] parameters:
name: user in: path description: User ID to fetch data for (or 'current') required: true schema: type: string
name: q in: query description: Query to filter projects by schema: type: string responses: 200: description: OK schema: v1.ProjectsViewModel
Requires ApiKeyAuth: Set header Authorization to your API Key
encoded as Base64 and prefixed with Basic.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | No | ||
| user | No | current |
Implementation Reference
- src/mcp_tools/projects.py:16-58 (handler)The @app.tool decorated handler function implementing the get_projects MCP tool logic, including input parameters, OpenAPI schema in docstring, and calling the Wakapi client.@app.tool async def get_projects( user: str = "current", q: Optional[str] = None ) -> ProjectsViewModel: """Retrieve and filter the user's projects. operationId: get-wakatime-projects summary: Retrieve and filter the user's projects description: Mimics https://wakatime.com/developers#projects tags: [wakatime] parameters: - name: user in: path description: User ID to fetch data for (or 'current') required: true schema: type: string - name: q in: query description: Query to filter projects by schema: type: string responses: 200: description: OK schema: v1.ProjectsViewModel 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 logger.info(f"get_projects called with user={user}, q={q}") client = get_wakapi_client() try: projects = await client.get_projects(user=user, q=q) logger.info(f"get_projects result type: {type(projects)}") return projects except Exception as e: logger.error(f"Error in get_projects: {e}") raise ValueError(f"Failed to fetch projects: {e}") from e
- main.py:133-135 (registration)Registration of the get_projects tool by importing it within the initialize_tools function, triggering auto-registration via the @app.tool decorator.from mcp_tools.projects import get_projects _ = get_projects # Trigger registration