Skip to main content
Glama
mackenly

MCP Fathom Analytics

by mackenly

list-sites

Retrieve all analytics sites from your Fathom Analytics account to manage and monitor website performance data.

Instructions

List all Fathom Analytics sites on the account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoOptional limit on the number of sites to return

Implementation Reference

  • Handler function that executes the 'list-sites' tool logic: fetches sites from Fathom Analytics API, formats the list or handles empty/error cases.
    async ({ limit }) => { try { const sites = await fathomClient.api.getAllSites(limit); if (sites.length === 0) { return { content: [ { type: "text", text: "No sites found.", }, ], }; } const sitesText = sites.map(site => `ID: ${site.id}\nName: ${site.name}\nSharing: ${site.sharing}\nCreated: ${site.created_at}\n` ).join("\n---\n\n"); return { content: [ { type: "text", text: `Sites (${sites.length}):\n\n${sitesText}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to retrieve sites: ${error instanceof FathomApiError ? `${error.status}: ${error.error}` : String(error)}`, }, ], }; } }, );
  • Input schema for the 'list-sites' tool, defining an optional positive integer limit using Zod.
    limit: z.number().positive().optional().describe("Optional limit on the number of sites to return") },
  • Registration of the 'list-sites' tool via server.tool() call within the registerSitesTool function.
    export function registerSitesTool(server: McpServer, fathomClient: FathomApi): void { server.tool( "list-sites", "List all Fathom Analytics sites on the account", { limit: z.number().positive().optional().describe("Optional limit on the number of sites to return") }, async ({ limit }) => { try { const sites = await fathomClient.api.getAllSites(limit); if (sites.length === 0) { return { content: [ { type: "text", text: "No sites found.", }, ], }; } const sitesText = sites.map(site => `ID: ${site.id}\nName: ${site.name}\nSharing: ${site.sharing}\nCreated: ${site.created_at}\n` ).join("\n---\n\n"); return { content: [ { type: "text", text: `Sites (${sites.length}):\n\n${sitesText}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to retrieve sites: ${error instanceof FathomApiError ? `${error.status}: ${error.error}` : String(error)}`, }, ], }; } }, ); }
  • src/index.ts:34-34 (registration)
    Top-level call to register the sites tool during MCP server setup.
    registerSitesTool(server, fathomClient);

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