Skip to main content
Glama
colintoh

Clicky MCP Server

by colintoh

get_page_traffic

Retrieve traffic analytics for a specific webpage by providing its URL and date range to analyze visitor data and page performance metrics.

Instructions

Get traffic data for a specific page by filtering with its URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesFull URL or path of the page to get traffic for (e.g., https://example.com/path or /path)
start_dateYesStart date in YYYY-MM-DD format
end_dateYesEnd date in YYYY-MM-DD format

Implementation Reference

  • The main handler function that processes the get_page_traffic tool call, constructs date range, calls the ClickyClient helper, formats JSON response or error.
    export async function handleGetPageTraffic(
      args: { url: string; start_date: string; end_date: string },
      clickyClient: ClickyClient
    ) {
      try {
        const dateRange: DateRange = {
          startDate: args.start_date,
          endDate: args.end_date
        };
    
        const data = await clickyClient.getPageTraffic(args.url, dateRange);
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(data, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching page traffic: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
  • Tool definition with input schema specifying required parameters: url (string), start_date and end_date (YYYY-MM-DD strings with pattern validation).
    export const getPageTrafficTool: Tool = {
      name: 'get_page_traffic',
      description: 'Get traffic data for a specific page by filtering with its URL',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'Full URL or path of the page to get traffic for (e.g., https://example.com/path or /path)'
          },
          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'
          }
        },
        required: ['url', 'start_date', 'end_date']
      }
    };
  • src/index.ts:91-99 (registration)
    Registration in listToolsRequestHandler: getPageTrafficTool is included in the array of available tools advertised to MCP clients.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        getTotalVisitorsTool,
        getDomainVisitorsTool,
        getTopPagesTool,
        getTrafficSourcesTool,
        getPageTrafficTool,
      ],
    }));
  • src/index.ts:118-119 (registration)
    Dispatch in callToolRequestHandler switch: routes calls to 'get_page_traffic' to the specific handleGetPageTraffic function.
    case 'get_page_traffic':
      return await handleGetPageTraffic(args as any, this.clickyClient);
  • ClickyClient helper method that queries the Clicky API 'pages' endpoint with filter=path to retrieve traffic data for the specific page.
    async getPageTraffic(url: string, dateRange: DateRange): Promise<any> {
      this.validateDateRange(dateRange);
    
      // Extract path from URL and encode it
      let path: string;
      try {
        const urlObj = new URL(url);
        path = urlObj.pathname;
      } catch (error) {
        // If URL parsing fails, assume it's already a path
        path = url.startsWith('/') ? url : '/' + url;
      }
    
      // Use raw path - Axios will handle the URL encoding automatically
      const filterPath = path;
    
      const response = await this.client.get('', {
        params: {
          site_id: this.siteId,
          sitekey: this.siteKey,
          type: 'pages',
          filter: filterPath,
          date: `${dateRange.startDate},${dateRange.endDate}`,
          output: 'json'
        }
      });
    
      return response.data;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves traffic data but doesn't mention any behavioral traits such as rate limits, authentication requirements, data freshness, or what the output format looks like (e.g., metrics like pageviews, sessions). This is a significant gap for a tool with no annotation coverage.

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. It's front-loaded and every part earns its place, making it easy to parse quickly.

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 complexity of a traffic data tool with no annotations and no output schema, the description is incomplete. It lacks details on what traffic data is returned (e.g., metrics, format), behavioral aspects like permissions or limits, and differentiation from sibling tools, leaving the agent with insufficient context for effective use.

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?

The description adds minimal value beyond the input schema, which has 100% coverage with clear descriptions for all three parameters (url, start_date, end_date). It implies URL-based filtering but doesn't provide additional context like URL format constraints or date range implications. Baseline 3 is appropriate as the schema does the heavy lifting.

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 tool's purpose with a specific verb ('Get') and resource ('traffic data for a specific page'), and it specifies the filtering mechanism ('by filtering with its URL'). However, it doesn't explicitly differentiate this tool from its siblings like 'get_top_pages' or 'get_total_visitors', which likely provide different scopes or aggregations of traffic data.

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 its siblings (e.g., 'get_domain_visitors', 'get_top_pages', 'get_total_visitors', 'get_traffic_sources'). It mentions filtering by URL but doesn't explain alternative scenarios or exclusions, leaving the agent to infer usage from tool names alone.

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