Skip to main content
Glama
nks-hub

rybbit-mcp

by nks-hub

List Users

rybbit_list_users
Read-onlyIdempotent

Retrieve user analytics data for a website, including IDs, session counts, timestamps, and traits, with filtering by dimensions and search by username or email.

Instructions

List users for a site. Returns user IDs, session counts, first/last seen dates, and user traits. Supports filtering by any analytics dimension. Use 'search' param to find users by username/email/name (case-insensitive partial match).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteIdYesSite ID (numeric ID or domain identifier)
startDateNoStart date in ISO format (YYYY-MM-DD)
endDateNoEnd date in ISO format (YYYY-MM-DD)
timeZoneNoIANA timezone (e.g., Europe/Prague). Default: UTC
filtersNoArray of filters. Example: [{parameter:'browser',type:'equals',value:['Chrome']},{parameter:'country',type:'equals',value:['US','DE']}]
pastMinutesStartNoAlternative to dates: minutes ago start (e.g., 60 = last hour)
pastMinutesEndNoAlternative to dates: minutes ago end (default 0 = now)
pageNoPage number, 1-indexed (default: 1)
limitNoResults per page (default: 20-50 depending on endpoint, max 200)
searchNoSearch users by trait value (e.g. username, email). Uses case-insensitive partial matching (ILIKE).
searchFieldNoWhich field to search in (default: 'username'). Only used when 'search' is provided.
identifiedOnlyNoOnly return identified users (users with identified_user_id). Default: false.
sortByNoSort field (default: 'last_seen'). 'duration' sorts by total time spent (aggregated from sessions, requires date range).
sortOrderNoSort direction (default: 'desc')

Implementation Reference

  • The handler function for the `rybbit_list_users` tool. It handles the logic for listing users, including a special case for sorting by 'duration' and a workaround for the 'event_name' filter limitation.
      async (args) => {
        try {
          if (args.sortBy === "duration") {
            const data = await fetchUsersByDuration(client, args.siteId, {
              startDate: args.startDate,
              endDate: args.endDate,
              timeZone: args.timeZone,
              filters: args.filters,
              pastMinutesStart: args.pastMinutesStart,
              pastMinutesEnd: args.pastMinutesEnd,
              sortOrder: args.sortOrder,
              limit: args.limit,
            });
            return {
              content: [{ type: "text" as const, text: truncateResponse(data) }],
            };
          }
    
          // Workaround: event_name filter crashes the backend getUsers endpoint
          // (applies session-level subquery to CTE outer query where session_id doesn't exist).
          // Strip it from filters and add a warning.
          const safeFilters = args.filters?.filter(
            (f) => f.parameter !== "event_name"
          );
          const hadEventFilter = safeFilters?.length !== args.filters?.length;
          const safeArgs = { ...args, filters: safeFilters };
    
          const params = client.buildAnalyticsParams(safeArgs);
          if (args.search) params.search = args.search;
          if (args.searchField) params.search_field = args.searchField;
          if (args.identifiedOnly) params.identified_only = "true";
          if (args.sortBy) params.sort_by = args.sortBy;
          if (args.sortOrder) params.sort_order = args.sortOrder;
          const data = await client.get(`/sites/${args.siteId}/users`, params);
    
          const warning = hadEventFilter
            ? "\n\nNote: event_name filter was removed (not supported for user listing due to backend limitation). Use rybbit_get_user_event_breakdown to find users by specific events."
            : "";
    
          return {
            content: [{ type: "text" as const, text: truncateResponse(data) + warning }],
          };
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          return {
            content: [{ type: "text" as const, text: `Error: ${message}` }],
            isError: true,
          };
        }
      }
    );
  • The registration of the `rybbit_list_users` tool, including its description and input schema.
    server.registerTool(
      "rybbit_list_users",
      {
        title: "List Users",
        annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true, destructiveHint: false },
        description:
          "List users for a site. Returns user IDs, session counts, first/last seen dates, and user traits. Supports filtering by any analytics dimension. Use 'search' param to find users by username/email/name (case-insensitive partial match).",
        inputSchema: {
          ...analyticsInputSchema,
          ...paginationSchema,
          search: z
            .string()
            .optional()
            .describe("Search users by trait value (e.g. username, email). Uses case-insensitive partial matching (ILIKE)."),
          searchField: z
            .enum(["username", "name", "email", "user_id"])
            .optional()
            .describe("Which field to search in (default: 'username'). Only used when 'search' is provided."),
          identifiedOnly: z
            .boolean()
            .optional()
            .describe("Only return identified users (users with identified_user_id). Default: false."),
          sortBy: z
            .enum(["first_seen", "last_seen", "pageviews", "sessions", "events", "duration"])
            .optional()
            .describe("Sort field (default: 'last_seen'). 'duration' sorts by total time spent (aggregated from sessions, requires date range)."),
          sortOrder: z
            .enum(["asc", "desc"])
            .optional()
            .describe("Sort direction (default: 'desc')"),
        },
      },
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare readOnly/idempotent/destructive=false, so safety is covered. Description adds valuable behavioral details: specifies exact return fields (compensating for missing output schema) and explains search matching behavior ('case-insensitive partial match'). No contradictions with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, zero waste. Front-loaded with purpose and return values, followed by filtering capability and specific search guidance. Every clause delivers unique information not redundant with schema or annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequately compensates for lack of output schema by documenting return fields. Covers key behavioral aspects (filtering, search) for a 14-parameter tool. Given excellent schema coverage and present annotations, description appropriately focuses on high-level capabilities rather than repeating param details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage, baseline is 3. Description adds semantic value by explaining the purpose of the 'search' parameter (finding users by identity fields) and contextualizing the 'filters' array ('any analytics dimension'). This goes beyond raw schema definitions to explain usage intent.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool 'List users for a site' with specific return values (user IDs, session counts, dates, traits). The plural 'users' and 'list' verb effectively distinguish it from sibling rybbit_get_user (singular), establishing this returns a collection vs. individual record.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context on key capabilities: 'Supports filtering by any analytics dimension' and specific guidance on using the 'search' param for username/email/name lookups with case-insensitive matching. Lacks explicit contrast with rybbit_get_user, but offers sufficient operational context for an agent to select it when needing bulk user data with filtering.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/nks-hub/rybbit-mcp'

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