Skip to main content
Glama
nks-hub

rybbit-mcp

by nks-hub

Get Page Titles

rybbit_get_page_titles
Read-onlyIdempotent

Retrieve the most-viewed page titles for a site, showing pageviews and unique sessions per title. Provides readable names instead of raw paths.

Instructions

Get the most-viewed page titles for a site, broken down by pageviews and unique sessions. Complements rybbit_get_metric with parameter='pathname' by giving the human-readable page title instead of just the path.

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

  • Registers the 'rybbit_get_page_titles' tool with the MCP server, including its title, description, input schema (analyticsInputSchema), annotations, and the handler callback.
    server.registerTool(
      "rybbit_get_page_titles",
      {
        title: "Get Page Titles",
        description:
          "Get the most-viewed page titles for a site, broken down by pageviews and unique sessions. Complements rybbit_get_metric with parameter='pathname' by giving the human-readable page title instead of just the path.",
        inputSchema: {
          ...analyticsInputSchema,
        },
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: true,
        },
      },
      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(`/sites/${siteId}/page-titles`, 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,
          };
        }
      }
    );
  • Handler function for rybbit_get_page_titles. Extracts siteId and analytics params, calls client.get('/sites/{siteId}/page-titles', params), and returns the response or an error.
      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(`/sites/${siteId}/page-titles`, 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 used as the input schema for rybbit_get_page_titles. Defines siteId, startDate, endDate, timeZone, filters, pastMinutesStart, pastMinutesEnd.
    export const analyticsInputSchema = {
      siteId: siteIdSchema,
      startDate: z
        .string()
        .optional()
        .describe("Start date in ISO format (YYYY-MM-DD)"),
      endDate: z
        .string()
        .optional()
        .describe("End date in ISO format (YYYY-MM-DD)"),
      timeZone: z
        .string()
        .optional()
        .describe("IANA timezone (e.g., Europe/Prague). Default: UTC"),
      filters: z
        .array(filterSchema)
        .optional()
        .describe("Array of filters. Example: [{parameter:'browser',type:'equals',value:['Chrome']},{parameter:'country',type:'equals',value:['US','DE']}]"),
      pastMinutesStart: z
        .number()
        .optional()
        .describe("Alternative to dates: minutes ago start (e.g., 60 = last hour)"),
      pastMinutesEnd: z
        .number()
        .optional()
        .describe("Alternative to dates: minutes ago end (default 0 = now)"),
    };
  • buildAnalyticsParams helper method on RybbitClient, converts the analytics options to URL query parameters (snake_case) used in the API call.
    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;
    }
  • truncateResponse helper function that truncates JSON responses to CHARACTER_LIMIT (25000 chars) for safe display.
    export function truncateResponse(data: unknown): string {
      const json = JSON.stringify(data, null, 2);
      if (json.length <= CHARACTER_LIMIT) return json;
    
      if (Array.isArray(data)) {
        const half = Math.max(1, Math.floor(data.length / 2));
        const truncated = data.slice(0, half);
        const result = {
          data: truncated,
          truncated: true,
          truncation_message: `Response truncated from ${data.length} to ${half} items (exceeded ${CHARACTER_LIMIT} char limit). Use pagination (page/limit) or add filters to reduce results.`,
        };
        return JSON.stringify(result, null, 2);
      }
    
      return json.slice(0, CHARACTER_LIMIT) +
        `\n\n[Response truncated at ${CHARACTER_LIMIT} characters. Use filters or pagination to reduce data.]`;
    }
Behavior4/5

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

Annotations already indicate read-only, idempotent, and open-world behavior. The description adds that the tool breaks down by pageviews and unique sessions, providing concrete output details beyond 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?

Two concise sentences: first states what the tool does and its output, second explains its relationship to a sibling. Every sentence is essential and front-loaded.

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

Completeness5/5

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

Given the read-only nature, good annotations, and clear parameters, the description fully captures the tool's purpose and output without needing an output schema.

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?

Schema coverage is 100%, so parameters are well-documented. The description adds value by clarifying that output includes page titles and metrics, which goes beyond individual parameter descriptions.

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 the most-viewed page titles for a site, broken down by pageviews and unique sessions, and distinguishes it from the sibling rybbit_get_metric by highlighting human-readable titles over paths.

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?

The description explicitly frames the tool as a complement to rybbit_get_metric with parameter='pathname', providing clear context for when to use it instead of the sibling. While it doesn't list exclusions, the guidance is sufficient.

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