Skip to main content
Glama
Mzaxd

Umami MCP Server

by Mzaxd

Get Umami Active Visitors

umami_get_active
Read-only

Retrieve the number of active visitors on a website within the last 5 minutes by providing the website ID. Enables real-time monitoring of current audience engagement.

Instructions

Get the number of active visitors on a website during the last 5 minutes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
websiteIdYesUmami website ID. Use umami_list_websites or umami_find_website first if you do not know it.

Implementation Reference

  • The core handler for umami_get_active tool. Calls `dependencies.client.getActive(websiteId)` and returns the active visitor count.
    createToolHandler(async ({ websiteId }) => {
      const result = await dependencies.client.getActive(websiteId);
    
      return {
        websiteId,
        activeVisitors: result.visitors,
        visitors: result.visitors,
      };
    }),
  • Input schema for umami_get_active requiring a websiteId string (via websiteIdSchema).
    const getActiveInputSchema = z.object({
      websiteId: websiteIdSchema,
    });
  • Registration of the tool named 'umami_get_active' on the MCP server with title, description, inputSchema, and handler.
    server.registerTool(
      "umami_get_active",
      {
        title: "Get Umami Active Visitors",
        description:
          "Get the number of active visitors on a website during the last 5 minutes.",
        inputSchema: getActiveInputSchema,
        annotations: readOnlyAnnotations,
      },
      createToolHandler(async ({ websiteId }) => {
        const result = await dependencies.client.getActive(websiteId);
    
        return {
          websiteId,
          activeVisitors: result.visitors,
          visitors: result.visitors,
        };
      }),
    );
  • Generic `createToolHandler` wrapper used by umami_get_active. Wraps the handler with error handling and response formatting.
    export function createToolHandler<Args extends object>(
      handler: (args: Args) => Promise<Record<string, unknown>>,
    ): (args: Args) => Promise<CallToolResult> {
      return async (args: Args) => {
        try {
          const payload = {
            ok: true,
            ...await handler(args),
          };
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(payload, null, 2),
              },
            ],
            structuredContent: payload,
          };
        } catch (error) {
          const payload = {
            ok: false,
            error: toErrorPayload(error),
          };
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(payload, null, 2),
              },
            ],
            structuredContent: payload,
            isError: true,
          };
        }
      };
    }
  • Registration entry point: calls `registerActiveTool` alongside other tools.
      registerActiveTool(server, dependencies);
      registerEventsTool(server, dependencies);
    }
Behavior4/5

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

Annotations already declare readOnlyHint=true, so the description carries less burden. It adds the specific time window ('last 5 minutes'), which is a useful behavioral detail beyond the annotation.

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?

A single, concise sentence that contains no filler or redundant information. Every word adds value.

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

Completeness4/5

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

For a simple read-only tool with one parameter and no output schema, the description is fairly complete. It specifies the metric and time window, and the parameter description provides guidance on how to find the websiteId. However, it does not explicitly state the return type (e.g., integer).

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 schema has 100% description coverage, so the baseline is 3. The tool description adds no additional meaning about the parameter; the parameter's own description already explains how to obtain the websiteId.

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

Purpose5/5

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

The description clearly states the specific verb (Get), resource (active visitors), and scope (last 5 minutes), distinguishing it from siblings like umami_get_pageviews or umami_get_stats.

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 does not provide any guidance on when to use this tool versus alternatives, nor does it mention when not to use it. The parameter description hints at prerequisites but the main description lacks usage context.

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/Mzaxd/umami-mcp'

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