Skip to main content
Glama

get_stats

Retrieve coding statistics for a specific user across various time ranges, with optional filters for projects, languages, editors, and operating systems to analyze development activity patterns.

Instructions

Retrieve statistics for a given user.

operationId: get-wakatime-stats summary: Retrieve statistics for a given user description: Mimics https://wakatime.com/developers#stats tags: [wakatime] parameters:

  • name: user in: path description: User ID to fetch data for (or 'current') required: true schema: type: string

  • name: range in: path description: Range interval identifier required: true schema: type: string enum: [ "today", "yesterday", "week", "month", "year", "7_days", "last_7_days", "30_days", "last_30_days", "6_months", "last_6_months", "12_months", "last_12_months", "last_year", "any", "all_time" ]

  • name: project in: query description: Project to filter by schema: type: string

  • name: language in: query description: Language to filter by schema: type: string

  • name: editor in: query description: Editor to filter by schema: type: string

  • name: operating_system in: query description: OS to filter by schema: type: str

  • name: machine in: query description: Machine to filter by schema: type: string

  • name: label in: query description: Project label to filter by schema: type: string responses: 200: description: OK schema: v1.StatsViewModel

Requires ApiKeyAuth: Set header Authorization to your API Key encoded as Base64 and prefixed with Basic.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
editorNo
labelNo
languageNo
machineNo
operating_systemNo
projectNo
rangeYes
userYes

Implementation Reference

  • The core handler function for the 'get_stats' MCP tool. It is decorated with @app.tool, defines input parameters with types and docstring-based OpenAPI schema, fetches data via Wakapi client, and returns StatsViewModel.
    @app.tool async def get_stats( user: str, range: str, project: Optional[str] = None, language: Optional[str] = None, editor: Optional[str] = None, operating_system: Optional[str] = None, machine: Optional[str] = None, label: Optional[str] = None, ) -> StatsViewModel: """ Retrieve statistics for a given user. operationId: get-wakatime-stats summary: Retrieve statistics for a given user description: Mimics https://wakatime.com/developers#stats tags: [wakatime] parameters: - name: user in: path description: User ID to fetch data for (or 'current') required: true schema: type: string - name: range in: path description: Range interval identifier required: true schema: type: string enum: [ "today", "yesterday", "week", "month", "year", "7_days", "last_7_days", "30_days", "last_30_days", "6_months", "last_6_months", "12_months", "last_12_months", "last_year", "any", "all_time" ] - name: project in: query description: Project to filter by schema: type: string - name: language in: query description: Language to filter by schema: type: string - name: editor in: query description: Editor to filter by schema: type: string - name: operating_system in: query description: OS to filter by schema: type: str - name: machine in: query description: Machine to filter by schema: type: string - name: label in: query description: Project label to filter by schema: type: string responses: 200: description: OK schema: v1.StatsViewModel 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: stats_data: StatsViewModel = await client.get_stats( range=range, user=user, project=project, language=language, editor=editor, operating_system=operating_system, machine=machine, label=label, ) return stats_data except Exception as e: raise ValueError(f"Failed to fetch stats: {e}") from e
  • main.py:130-132 (registration)
    Registration of the get_stats tool by importing it in initialize_tools(), which triggers the @app.tool decorator registration.
    from mcp_tools.stats import get_stats _ = get_stats # Trigger registration
  • OpenAPI-style schema definition in the docstring of get_stats, defining input parameters, enums, and output schema reference.
    """ Retrieve statistics for a given user. operationId: get-wakatime-stats summary: Retrieve statistics for a given user description: Mimics https://wakatime.com/developers#stats tags: [wakatime] parameters: - name: user in: path description: User ID to fetch data for (or 'current') required: true schema: type: string - name: range in: path description: Range interval identifier required: true schema: type: string enum: [ "today", "yesterday", "week", "month", "year", "7_days", "last_7_days", "30_days", "last_30_days", "6_months", "last_6_months", "12_months", "last_12_months", "last_year", "any", "all_time" ] - name: project in: query description: Project to filter by schema: type: string - name: language in: query description: Language to filter by schema: type: string - name: editor in: query description: Editor to filter by schema: type: string - name: operating_system in: query description: OS to filter by schema: type: str - name: machine in: query description: Machine to filter by schema: type: string - name: label in: query description: Project label to filter by schema: type: string responses: 200: description: OK schema: v1.StatsViewModel Requires ApiKeyAuth: Set header `Authorization` to your API Key encoded as Base64 and prefixed with `Basic`. """

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/impure0xntk/mcp-wakapi'

If you have feedback or need assistance with the MCP directory API, please join our Discord server