Skip to main content
Glama
nks-hub

rybbit-mcp

by nks-hub

User Retention

rybbit_get_retention
Read-onlyIdempotent

Retrieve user retention cohort analysis to measure how many users return over specified time periods. Provide site ID, date range, and optional filters to analyze returning user behavior.

Instructions

Get user retention cohort analysis showing how many users return over time periods.

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)

Implementation Reference

  • Handler function for the rybbit_get_retention tool. Extracts siteId and analytics params, calls GET /sites/{siteId}/retention API endpoint, and returns retention cohort data.
      async (args) => {
        try {
          const { siteId, ...rest } = args as {
            siteId: string;
            startDate?: string;
            endDate?: string;
            timeZone?: string;
            filters?: Array<{ parameter: string; type: string; value: (string | number)[] }>;
            pastMinutesStart?: number;
            pastMinutesEnd?: number;
          };
    
          const params = client.buildAnalyticsParams(rest);
    
          const data = await client.get<RetentionData[]>(
            `/sites/${siteId}/retention`,
            params
          );
    
          return {
            content: [
              {
                type: "text" as const,
                text: truncateResponse(data),
              },
            ],
          };
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          return {
            content: [{ type: "text" as const, text: `Error: ${message}` }],
            isError: true,
          };
        }
      }
    );
  • Registration of the 'rybbit_get_retention' tool with McpServer, including title 'User Retention', description, annotations (readOnlyHint, idempotentHint, openWorldHint), and inputSchema.
    server.registerTool(
      "rybbit_get_retention",
      {
        title: "User Retention",
        description:
          "Get user retention cohort analysis showing how many users return over time periods.",
        annotations: {
          readOnlyHint: true,
          idempotentHint: true,
          openWorldHint: true,
          destructiveHint: false,
        },
        inputSchema: {
          ...analyticsInputSchema,
        },
      },
      async (args) => {
        try {
          const { siteId, ...rest } = args as {
            siteId: string;
            startDate?: string;
            endDate?: string;
            timeZone?: string;
            filters?: Array<{ parameter: string; type: string; value: (string | number)[] }>;
            pastMinutesStart?: number;
            pastMinutesEnd?: number;
          };
    
          const params = client.buildAnalyticsParams(rest);
    
          const data = await client.get<RetentionData[]>(
            `/sites/${siteId}/retention`,
            params
          );
    
          return {
            content: [
              {
                type: "text" as const,
                text: truncateResponse(data),
              },
            ],
          };
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          return {
            content: [{ type: "text" as const, text: `Error: ${message}` }],
            isError: true,
          };
        }
      }
    );
  • analyticsInputSchema shared input schema used by rybbit_get_retention, defining siteId, startDate, endDate, timeZone, filters, pastMinutesStart, pastMinutesEnd.
    export const analyticsInputSchema = {
  • src/index.ts:40-40 (registration)
    Entry point call to registerMetricsTools(server, client) which registers rybbit_get_retention among other metric tools.
    registerMetricsTools(server, client);
  • buildAnalyticsParams helper method on RybbitClient that transforms query parameters (startDate, endDate, filters, etc.) into API-compatible query params.
      buildAnalyticsParams(options: {
        startDate?: string;
        endDate?: string;
        timeZone?: string;
        filters?: FilterParam[];
        pastMinutesStart?: number;
        pastMinutesEnd?: number;
        bucket?: string;
        page?: number;
        limit?: number;
        offset?: number;
      }): QueryParams {
        const params: QueryParams = {};
    
        if (options.startDate) params.start_date = options.startDate;
        if (options.endDate) params.end_date = options.endDate;
        if (options.timeZone) params.time_zone = options.timeZone;
        if (options.filters && options.filters.length > 0) {
          params.filters = JSON.stringify(options.filters);
        }
        if (options.pastMinutesStart !== undefined)
          params.past_minutes_start = options.pastMinutesStart;
        if (options.pastMinutesEnd !== undefined)
          params.past_minutes_end = options.pastMinutesEnd;
        if (options.bucket) params.bucket = options.bucket;
        if (options.page !== undefined) params.page = options.page;
        if (options.limit !== undefined) params.limit = options.limit;
        if (options.offset !== undefined) params.offset = options.offset;
    
        return params;
      }
    }
Behavior4/5

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

Annotations already signal read-only, idempotent behavior. The description adds that it shows returning users over time periods, which clarifies the output scope. No contradictions, and no additional side effects are relevant.

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?

The description is a single, concise sentence (14 words) that front-loads the verb and resource. Every word earns its place with no redundancy.

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

Completeness3/5

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

Given the tool has 7 parameters and no output schema, the description lacks details about the return format (e.g., columns, period granularity). It adequately states the purpose but leaves the agent uninformed about what exact data to expect.

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

Parameters3/5

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

Input schema has 100% description coverage for all 7 parameters, so the description adds no additional meaning. The baseline of 3 is appropriate as the tool description does not compensate further.

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?

The description clearly states the tool retrieves user retention cohort analysis, specifying the action ('get') and resource ('user retention'). It distinguishes from sibling tools like rybbit_get_metric or rybbit_get_overview by focusing on cohort retention over time periods.

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

Usage Guidelines3/5

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

The description does not explicitly guide when to use this tool versus alternatives like rybbit_get_metric or rybbit_get_overview_timeseries. Usage must be inferred from the purpose, leaving room for improvement.

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