Skip to main content
Glama
logly-uk

Logly MCP server

Official
by logly-uk

logly_stats

Retrieve traffic totals for a site: pageviews, sessions, visitors, bounce rate, and average duration. Includes daily series and comparison with previous period.

Instructions

Traffic totals for a site — pageviews, sessions, visitors, bounce rate, average duration — plus a daily series and a comparison against the previous period.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteYesLogly site ID (slug). Call logly_list_sites to discover it.
daysNoDays to look back: 7, 30 or 90. Defaults to 30. Ignored when 'from'/'to' are set.
fromNoRange start, YYYY-MM-DD. Use together with 'to'.
toNoRange end, YYYY-MM-DD. Use together with 'from'.

Implementation Reference

  • index.js:60-66 (handler)
    The handler for the logly_stats tool calls loglyApi with the /api/sites/{site}/stats endpoint, passing the date range parameters (days, from, to) to retrieve traffic totals.
    tool(
      "logly_stats",
      "Traffic totals for a site — pageviews, sessions, visitors, bounce rate, average duration — plus a daily series and a comparison against the previous period.",
      { site: siteArg, days: daysArg, from: fromArg, to: toArg },
      ({ site, days, from, to }) =>
        loglyApi(`/api/sites/${encodeURIComponent(site)}/stats`, range({ days, from, to }))
    );
  • Zod schema definitions for the input parameters used by logly_stats: site (required string), days (optional positive int), from (optional string), to (optional string).
    const siteArg = z.string().describe("Logly site ID (slug). Call logly_list_sites to discover it.");
    const daysArg = z.number().int().positive().optional()
      .describe("Days to look back: 7, 30 or 90. Defaults to 30. Ignored when 'from'/'to' are set.");
    const fromArg = z.string().optional().describe("Range start, YYYY-MM-DD. Use together with 'to'.");
    const toArg = z.string().optional().describe("Range end, YYYY-MM-DD. Use together with 'from'.");
  • index.js:37-45 (registration)
    Registration helper that wraps server.tool() with error handling. Invoked on line 60 to register 'logly_stats'.
    function tool(name, description, shape, fn) {
      server.tool(name, description, shape, async (args) => {
        try {
          return { content: [{ type: "text", text: await fn(args || {}) }] };
        } catch (e) {
          return { content: [{ type: "text", text: "Error: " + e.message }], isError: true };
        }
      });
    }
  • index.js:8-27 (helper)
    Helper function that makes authenticated API calls to Logly. Called by logly_stats handler to fetch statistics data.
    async function loglyApi(path, params) {
      const key = process.env.LOGLY_API_KEY;
      if (!key) {
        throw new Error(
          "LOGLY_API_KEY is not set. Create one in Logly → Settings → API keys."
        );
      }
      const url = new URL(BASE + path);
      for (const [k, v] of Object.entries(params || {})) {
        if (v !== undefined && v !== null && v !== "") url.searchParams.set(k, String(v));
      }
      const res = await fetch(url, {
        headers: { Authorization: `Bearer ${key}`, Accept: "application/json" },
      });
      const text = await res.text();
      if (!res.ok) {
        throw new Error(`Logly API ${res.status} on ${path}: ${text.slice(0, 300)}`);
      }
      return text;
    }
  • Helper function that normalizes date range parameters. Used by logly_stats to build query params for the API call.
    function range({ days, from, to }) {
      if (from || to) return { from, to };
      return { days: days ?? 30 };
    }
Behavior3/5

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

No annotations exist, so the description carries the full burden. It correctly implies a read operation (traffic totals) but does not disclose potential side effects, data freshness, rate limits, or authentication requirements. It is not misleading but lacks transparency about operational traits.

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

Conciseness4/5

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

The description is a single sentence that efficiently lists the key output components. It is front-loaded with the main purpose and avoids unnecessary words.

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?

Without an output schema, the description adequately explains the return values (specific metrics, daily series, comparison). However, it lacks details on pagination, timezone handling, or data range boundaries, which would enhance 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?

Schema coverage is 100%, so each parameter is already described in the schema. The description does not add any extra meaning or usage hints for the parameters; it focuses solely on output. Baseline score of 3 is appropriate.

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 it returns 'traffic totals' and lists specific metrics (pageviews, sessions, etc.) and additional features (daily series, comparison). The action is implied (retrieve), and it is distinct from sibling tools like logly_breakdown or logly_events, though not explicitly contrasted.

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 usage guidance, such as when to use this tool vs. alternatives (e.g., logly_breakdown for detailed breakdowns). No context about prerequisites or typical scenarios is given.

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/logly-uk/logly-mcp'

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