Skip to content

chore(analytics): implement simple get user count#41

Merged
mugdha-khatavkar merged 1 commit into
mainfrom
implement-get-user-count
Nov 27, 2025
Merged

chore(analytics): implement simple get user count#41
mugdha-khatavkar merged 1 commit into
mainfrom
implement-get-user-count

Conversation

@mugdha-khatavkar

@mugdha-khatavkar mugdha-khatavkar commented Nov 20, 2025

Copy link
Copy Markdown
Contributor

Summary
This PR implements the getUsersCount operation from the Algolia Analytics API, adding the ability to retrieve the number of unique users within a specified time range, including a daily breakdown.

Changes
New file: get_users_count.go

Implements the analytics_get_users_count MCP tool
Calls the Analytics API endpoint GET /2/users/count
Supports optional date range filtering and tag segmentation
Updated: analytics.go

Registered the new RegisterGetUsersCount function in the RegisterTools method

API Details
Endpoint: https://analytics.algolia.com/2/users/count

Parameters:
index (required): Index name to analyze
startDate (optional): Start date in YYYY-MM-DD format
endDate (optional): End date in YYYY-MM-DD format
tags (optional): Tags for analytics segmentation
Response: Returns the total count of unique users and a daily breakdown showing user counts per day.

Implementation Notes
Follows the established pattern used by other analytics tools (e.g., get_searches_count.go)
Uses the same authentication mechanism (environment variables ALGOLIA_APP_ID and ALGOLIA_API_KEY)
Includes proper error handling for API failures and invalid parameters
Returns results in the standard MCP tool result format

Testing
✅ Project builds successfully
✅ Tool is tested using the MCP inspector

@mugdha-khatavkar mugdha-khatavkar merged commit 0fdf146 into main Nov 27, 2025
2 checks passed
@mugdha-khatavkar mugdha-khatavkar deleted the implement-get-user-count branch November 27, 2025 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants