Skip to main content
Glama
Defilan

Plausible Analytics MCP Server

by Defilan

get-current-visitors

Retrieve real-time visitor count for a website to monitor current traffic activity using Plausible Analytics data.

Instructions

Get the number of people currently on a site (real-time)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
site_idYesDomain of the site (e.g. 'example.com')

Implementation Reference

  • The actual implementation of fetching current visitors from the Plausible API.
    async getCurrentVisitors(siteId: string): Promise<number> {
      const response = await fetch(
        `${this.baseUrl}/api/v1/stats/realtime/visitors?site_id=${encodeURIComponent(siteId)}`,
        {
          headers: {
            Authorization: `Bearer ${this.apiKey}`,
          },
        }
      );
    
      if (!response.ok) {
        const body = await response.text();
        throw new Error(
          `Plausible API error (${response.status}): ${body}`
        );
      }
    
      return response.json() as Promise<number>;
    }
  • src/index.ts:42-61 (registration)
    Registration of the 'get-current-visitors' tool and its handler, which calls PlausibleClient.getCurrentVisitors.
    // --- Tool: get-current-visitors ---
    
    server.tool(
      "get-current-visitors",
      "Get the number of people currently on a site (real-time)",
      {
        site_id: z.string().describe("Domain of the site (e.g. 'example.com')"),
      },
      async ({ site_id }) => {
        const visitors = await client.getCurrentVisitors(site_id);
        return {
          content: [
            {
              type: "text",
              text: `Current visitors on ${site_id}: ${visitors}`,
            },
          ],
        };
      }
    );
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 'real-time' as a behavioral trait, which is useful context. However, it doesn't disclose other important aspects such as rate limits, authentication needs, data freshness, or what happens with invalid site IDs, leaving significant gaps for a tool that likely queries live data.

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 purpose ('Get the number of people currently on a site') and adds a clarifying detail ('real-time'). There is zero wasted text, 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 (real-time data query), no annotations, and no output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits, usage context, and output format. It meets the minimum viable threshold but has clear gaps in completeness.

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, with the 'site_id' parameter clearly documented as the domain. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate since 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 ('number of people currently on a site'), and specifies the real-time nature. However, it doesn't explicitly differentiate from sibling tools like 'get-aggregate-stats' or 'get-timeseries', which might also provide visitor data in different formats.

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-aggregate-stats' or 'get-timeseries', nor does it mention prerequisites or exclusions. It implies usage for real-time visitor counts but lacks explicit context for tool selection.

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/Defilan/plausible-mcp'

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