Skip to main content
Glama
colintoh

Clicky MCP Server

by colintoh

get_top_pages

Retrieve the most visited website pages from Clicky analytics for a specified date range to analyze traffic patterns and content performance.

Instructions

Get top pages for a date range from Clicky analytics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYesStart date in YYYY-MM-DD format
end_dateYesEnd date in YYYY-MM-DD format
limitNoMaximum number of pages to return (default: API default, max: 1000)

Implementation Reference

  • The handler function that implements the core logic of the 'get_top_pages' tool. It parses the input arguments, calls the ClickyClient's getTopPages method, and returns the formatted response or error.
    export async function handleGetTopPages(
      args: { start_date: string; end_date: string; limit?: number },
      clickyClient: ClickyClient
    ) {
      try {
        const dateRange: DateRange = {
          startDate: args.start_date,
          endDate: args.end_date
        };
    
        const data = await clickyClient.getTopPages(dateRange, args.limit);
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(data, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching top pages: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
  • The tool definition object for 'get_top_pages' including the input schema for validation of parameters like start_date, end_date, and optional limit.
    export const getTopPagesTool: Tool = {
      name: 'get_top_pages',
      description: 'Get top pages for a date range from Clicky analytics',
      inputSchema: {
        type: 'object',
        properties: {
          start_date: {
            type: 'string',
            pattern: '^\\d{4}-\\d{2}-\\d{2}$',
            description: 'Start date in YYYY-MM-DD format'
          },
          end_date: {
            type: 'string',
            pattern: '^\\d{4}-\\d{2}-\\d{2}$',
            description: 'End date in YYYY-MM-DD format'
          },
          limit: {
            type: 'number',
            minimum: 1,
            maximum: 1000,
            description: 'Maximum number of pages to return (default: API default, max: 1000)'
          }
        },
        required: ['start_date', 'end_date']
      }
    };
  • src/index.ts:92-98 (registration)
    Registration of the getTopPagesTool in the listTools handler, making it discoverable by MCP clients.
    tools: [
      getTotalVisitorsTool,
      getDomainVisitorsTool,
      getTopPagesTool,
      getTrafficSourcesTool,
      getPageTrafficTool,
    ],
  • src/index.ts:112-113 (registration)
    Registration of the handler dispatch for 'get_top_pages' in the callTool request switch statement.
    case 'get_top_pages':
      return await handleGetTopPages(args as any, this.clickyClient);
  • Supporting method in ClickyClient that performs the actual API call to retrieve top pages data from Clicky analytics.
    async getTopPages(dateRange: DateRange, limit?: number): Promise<any> {
      this.validateDateRange(dateRange);
    
      const params: any = {
        site_id: this.siteId,
        sitekey: this.siteKey,
        type: 'pages',
        date: `${dateRange.startDate},${dateRange.endDate}`,
        output: 'json'
      };
    
      if (limit) {
        params.limit = Math.min(limit, 1000); // API max is 1000
      }
    
      const response = await this.client.get('', { params });
      return response.data;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions retrieving 'top pages' but doesn't specify what 'top' means (e.g., by views, visits, or other metrics), how results are ordered, if there's pagination, rate limits, authentication needs, or error handling. This leaves significant gaps in understanding the tool's behavior beyond basic functionality.

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, efficient sentence that directly states the tool's purpose without unnecessary words or fluff. It's front-loaded with the core action and resource, making it easy to parse quickly, which is ideal for conciseness in tool definitions.

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

Completeness2/5

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

Given the lack of annotations and output schema, and the description's minimal detail, it's incomplete for a tool that likely returns complex analytics data. It doesn't explain what 'top pages' entails, the structure of the output, or behavioral aspects like data freshness or limitations, leaving the agent with insufficient context to use the tool effectively beyond basic parameter input.

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?

Schema description coverage is 100%, with clear documentation for each parameter (start_date, end_date, limit) including formats, constraints, and defaults. The description adds no additional semantic details beyond implying date-range usage, so it meets the baseline of 3 where the schema handles most of the parameter explanation without extra value from the description.

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

Purpose4/5

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

The description clearly states the action ('Get') and resource ('top pages') with the source ('from Clicky analytics') and scope ('for a date range'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_page_traffic' or 'get_total_visitors', which might also involve date ranges or page-related data, leaving some ambiguity about uniqueness.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_page_traffic' or 'get_traffic_sources', nor does it mention any prerequisites, exclusions, or specific contexts. It only states what the tool does, without indicating appropriate scenarios or comparisons with siblings.

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/colintoh/clicky-mcp'

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