Skip to main content
Glama
mikusnuz

umami-mcp

batch_events

Send multiple analytics events or pageviews in a single batch request to reduce API calls and improve efficiency.

Instructions

Send multiple events or pageviews in a single batch request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventsYesArray of events to send

Implementation Reference

  • The handler for the 'batch_events' tool which processes and sends a batch of events via a POST request.
    async ({ events }) => {
      const payload = events.map((e) => {
        const p: Record<string, unknown> = {
          website: e.websiteId,
          hostname: e.hostname,
          url: e.url,
        };
        if (e.eventName) p.name = e.eventName;
        if (e.eventData) p.data = e.eventData;
        if (e.referrer) p.referrer = e.referrer;
        if (e.language) p.language = e.language;
        if (e.title) p.title = e.title;
        return {
          type: e.eventName ? "event" : "pageview",
          payload: p,
        };
      });
      await client.call("POST", "/api/batch", { events: payload });
      return { content: [{ type: "text", text: `Batch of ${events.length} events sent successfully.` }] };
    }
  • Registration and schema definition for the 'batch_events' tool.
    server.tool(
      "batch_events",
      "Send multiple events or pageviews in a single batch request",
      {
        events: z
          .array(
            z.object({
              websiteId: z.string().describe("Website UUID"),
              hostname: z.string().describe("Hostname"),
              url: z.string().describe("URL path"),
              eventName: z.string().optional().describe("Event name (omit for pageview)"),
              eventData: z.record(z.unknown()).optional().describe("Custom event data"),
              referrer: z.string().optional().describe("Referrer URL"),
              language: z.string().optional().describe("Browser language"),
              title: z.string().optional().describe("Page title"),
            })
          )
          .describe("Array of events to send"),
      },

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