Skip to main content
Glama
mikusnuz

umami-mcp

get_session_data_values

Retrieve aggregated counts of session property values for your website. Filter by property name and date range to analyze session data and uncover usage patterns.

Instructions

Get session data values (aggregated counts for session properties) for a website

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
websiteIdYesWebsite UUID
startAtYesStart timestamp in milliseconds
endAtYesEnd timestamp in milliseconds
propertyNameNoFilter by property name

Implementation Reference

  • The handler function that executes the 'get_session_data_values' tool logic. It calls GET /api/websites/{websiteId}/session-data/values with startAt, endAt, and optional propertyName query parameters, returning aggregated session data values.
    server.tool(
      "get_session_data_values",
      "Get session data values (aggregated counts for session properties) for a website",
      {
        websiteId: z.string().describe("Website UUID"),
        startAt: z.number().describe("Start timestamp in milliseconds"),
        endAt: z.number().describe("End timestamp in milliseconds"),
        propertyName: z.string().optional().describe("Filter by property name"),
      },
      async ({ websiteId, startAt, endAt, propertyName }) => {
        const data = await client.call(
          "GET",
          `/api/websites/${websiteId}/session-data/values`,
          undefined,
          { startAt, endAt, propertyName }
        );
        return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Input schema definition using Zod for the tool, defining websiteId (string), startAt (number), endAt (number), and optional propertyName (string) parameters.
    {
      websiteId: z.string().describe("Website UUID"),
      startAt: z.number().describe("Start timestamp in milliseconds"),
      endAt: z.number().describe("End timestamp in milliseconds"),
      propertyName: z.string().optional().describe("Filter by property name"),
    },
  • Registration of the tool via server.tool() call with the name 'get_session_data_values' and description. The containing function registerSessionTools is called in src/index.ts line 31.
      server.tool(
        "get_session_data_values",
        "Get session data values (aggregated counts for session properties) for a website",
        {
          websiteId: z.string().describe("Website UUID"),
          startAt: z.number().describe("Start timestamp in milliseconds"),
          endAt: z.number().describe("End timestamp in milliseconds"),
          propertyName: z.string().optional().describe("Filter by property name"),
        },
        async ({ websiteId, startAt, endAt, propertyName }) => {
          const data = await client.call(
            "GET",
            `/api/websites/${websiteId}/session-data/values`,
            undefined,
            { startAt, endAt, propertyName }
          );
          return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
        }
      );
    }
  • The UmamiClient.call() helper method used by the handler to make authenticated HTTP requests to the Umami API, handling tokens, query parameters, and error responses.
    async call(
      method: string,
      path: string,
      body?: Record<string, unknown>,
      query?: Record<string, string | number | boolean | undefined>
    ): Promise<unknown> {
      this.ensureConfigured();
    
      const token = await this.getToken();
    
      let url = `${this.config.baseUrl}${path}`;
      if (query) {
        const params = new URLSearchParams();
        for (const [k, v] of Object.entries(query)) {
          if (v !== undefined && v !== null && v !== "") {
            params.set(k, String(v));
          }
        }
        const qs = params.toString();
        if (qs) url += `?${qs}`;
      }
    
      const headers: Record<string, string> = {
        Authorization: `Bearer ${token}`,
      };
      if (body) {
        headers["Content-Type"] = "application/json";
      }
    
      const res = await fetch(url, {
        method,
        headers,
        body: body ? JSON.stringify(body) : undefined,
        signal: AbortSignal.timeout(30_000),
      });
    
      if (!res.ok) {
        const text = await res.text().catch(() => "");
        throw new Error(`Umami API error ${method} ${path} (${res.status}): ${text}`);
      }
    
      // Some endpoints return 200 with no body (e.g. DELETE)
      const contentType = res.headers.get("content-type") || "";
      if (contentType.includes("application/json")) {
        return res.json();
      }
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It implies a read-only operation but does not mention side effects, rate limits, prerequisites, or whether data is aggregated over time. Minimal behavioral context beyond the purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence is concise but omits important details like return format. It is not verbose but could be more structured, e.g., stating 'returns a mapping from property values to counts'.

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?

The tool has 4 parameters (3 required) and no output schema. The description does not explain the return format (e.g., aggregated counts might be a JSON object). Considering complexity, the description is incomplete.

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?

Input schema coverage is 100%, with each parameter having a description. The description does not add new information about parameters (e.g., explaining the optional propertyName filter). Baseline 3 is appropriate as schema already provides meaning.

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 verb 'Get', the resource 'session data values (aggregated counts for session properties)', and the context 'for a website'. It distinguishes from siblings like get_event_data_values and get_session_data_properties by specifying aggregated counts for session properties.

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?

No guidance on when to use this tool versus alternatives such as get_session_stats or get_session_data_properties. The description only states what it does without any contextual cues or 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/mikusnuz/umami-mcp'

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