Skip to main content
Glama
mackenly

MCP Fathom Analytics

by mackenly

list-events

Retrieve all events for a Fathom Analytics site, automatically handling pagination to simplify data access.

Instructions

List all events for a Fathom Analytics site (automatically handles pagination)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
site_idYesID of the site to retrieve events for
limitNoOptional limit on the number of events to return

Implementation Reference

  • The handler function for the 'list-events' tool. It fetches all events for a given Fathom Analytics site_id (with optional limit), handles pagination internally via fathomClient.api.getAllEvents, formats the events as text, and returns them in the MCP response format. Includes error handling.
    async ({ site_id, limit }) => {
        try {
            const events = await fathomClient.api.getAllEvents(site_id, limit);
            
            if (events.length === 0) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `No events found for site ${site_id}.`,
                        },
                    ],
                };
            }
    
            const eventsText = events.map(event => 
                `ID: ${event.id}\nName: ${event.name}\nCreated: ${event.created_at}\n`
            ).join("\n---\n\n");
            
            return {
                content: [
                    {
                        type: "text",
                        text: `All events for site ${site_id} (${events.length}):\n\n${eventsText}`,
                    },
                ],
            };
        } catch (error) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to retrieve events: ${error instanceof FathomApiError ? `${error.status}: ${error.error}` : String(error)}`,
                    },
                ],
            };
        }
    },
  • Input schema for the 'list-events' tool using Zod: requires site_id (string), optional limit (positive number). Descriptions provided.
    {
        site_id: z.string().describe("ID of the site to retrieve events for"),
        limit: z.number().positive().optional().describe("Optional limit on the number of events to return")
    },
  • Registration of the 'list-events' tool via server.tool() call inside the registerEventsTool function, including name, description, schema, and handler.
    server.tool(
        "list-events",
        "List all events for a Fathom Analytics site (automatically handles pagination)",
        {
            site_id: z.string().describe("ID of the site to retrieve events for"),
            limit: z.number().positive().optional().describe("Optional limit on the number of events to return")
        },
        async ({ site_id, limit }) => {
            try {
                const events = await fathomClient.api.getAllEvents(site_id, limit);
                
                if (events.length === 0) {
                    return {
                        content: [
                            {
                                type: "text",
                                text: `No events found for site ${site_id}.`,
                            },
                        ],
                    };
                }
    
                const eventsText = events.map(event => 
                    `ID: ${event.id}\nName: ${event.name}\nCreated: ${event.created_at}\n`
                ).join("\n---\n\n");
                
                return {
                    content: [
                        {
                            type: "text",
                            text: `All events for site ${site_id} (${events.length}):\n\n${eventsText}`,
                        },
                    ],
                };
            } catch (error) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to retrieve events: ${error instanceof FathomApiError ? `${error.status}: ${error.error}` : String(error)}`,
                        },
                    ],
                };
            }
        },
    );
Behavior3/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 adds useful context by mentioning automatic pagination handling, which is a key behavioral trait beyond the basic 'list' function. However, it doesn't cover other aspects like rate limits, authentication needs, or error handling, leaving gaps in transparency.

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 front-loads the core action ('List all events') and adds valuable behavioral context ('automatically handles pagination') without any wasted words. Every part earns its place, making it highly concise and well-structured.

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's moderate complexity (2 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the main action and pagination behavior, but lacks details on return values, error cases, or integration with sibling tools, leaving room for improvement in context.

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 input schema has 100% description coverage, so the schema already documents both parameters ('site_id' and 'limit') fully. The description implies filtering by site but doesn't add syntax or format details beyond what the schema provides, aligning with the baseline score when schema coverage is high.

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 verb ('List') and resource ('events for a Fathom Analytics site'), making the purpose evident. However, it doesn't explicitly differentiate from sibling tools like 'get-aggregation' or 'get-current-visitors', which might also retrieve event-related data, so it doesn't reach the highest score.

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, such as 'get-aggregation' for summarized data or 'get-current-visitors' for real-time events. It lacks explicit when/when-not statements or named alternatives, offering only basic context without exclusions.

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/mackenly/mcp-fathom-analytics'

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