query_user_activity¶
Query user activity within your project for admin users. Analyze user behavior, page views, and activity patterns from audit logs.
Admin-only tool — requires Admin or SuperAdmin role.
Query types: - summary: Overview metrics (user count, total requests, avg daily activity, top 10 active users) - user_detail: Activity for a specific user (requires user_email) — pages, frequency, last active - active_users: List unique users with request counts and last activity - page_views: Most visited routes/pages with counts - recent_activity: Chronological list of recent activity events
Filtering behavior: - Automatically scoped to your current project (only activity with project_id) - Super admin users are excluded from all results - Use start_date/end_date to filter activity to specific periods
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query_type |
string (enum: summary, user_detail, active_users, page_views, recent_activity) | yes | — | Type of activity analysis to perform |
user_email |
string | no | — | Filter to specific user (required for user_detail query type) |
start_date |
string | no | — | ISO date string for start of time window. |
end_date |
string | no | — | ISO date string for end of time window. |
limit |
integer | no | 50 |
Maximum number of results to return (1-100). |
Example call¶
from fastmcp import Client
from fastmcp.client.auth import BearerAuth
async with Client(
"https://mcp.chordia.ai/mcp",
auth=BearerAuth("YOUR_APPLICATION_KEY"),
) as client:
result = await client.call_tool(
"query_user_activity",
{
"query_type": "summary"
},
)
print(result.content[0].text)
# Plus any of the 4 optional params from the table above.
In Claude Desktop, Cursor, or any MCP-aware client the same call is issued by the LLM automatically once the server is configured — see integrations.
Result¶
Success responses are JSON of the shape below. Optional fields are omitted when the underlying data isn't present.
{
"events": [
{
"user_id": "u_123",
"user_name": "Casey",
"action": "session_open",
"session_id": "a1b2c3d4",
"timestamp": "2026-05-10T14:21:00Z"
}
],
"count": 1
}
Auth context¶
Every call receives the connection's project_id and access_scope
automatically — the caller never passes them. See
Authentication & RBAC for how scope narrows
results.
Errors¶
All tools return JSON. Errors are wrapped in { "error": "..." }. The
most common shapes are documented in
Python integration → Error shape.