logly_breakdown
Retrieve top pages, referrers, countries, and device/browser breakdowns for a site over a specified time period.
Instructions
Top pages, top referrers, top countries and device/browser split for a site over the given period.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | Yes | Logly site ID (slug). Call logly_list_sites to discover it. | |
| days | No | Days to look back: 7, 30 or 90. Defaults to 30. Ignored when 'from'/'to' are set. | |
| from | No | Range start, YYYY-MM-DD. Use together with 'to'. | |
| to | No | Range end, YYYY-MM-DD. Use together with 'from'. |
Implementation Reference
- index.js:68-74 (registration)Registration of the 'logly_breakdown' tool via the custom 'tool()' helper function. Registers name, description, Zod schema for 'site', 'days', 'from', 'to' arguments, and the handler logic.
tool( "logly_breakdown", "Top pages, top referrers, top countries and device/browser split for a site over the given period.", { site: siteArg, days: daysArg, from: fromArg, to: toArg }, ({ site, days, from, to }) => loglyApi(`/api/sites/${encodeURIComponent(site)}/breakdown`, range({ days, from, to })) ); - index.js:72-73 (handler)Handler function for logly_breakdown: calls the Logly API at /api/sites/{site}/breakdown with the date range parameters, returning top pages, top referrers, top countries, and device/browser split.
({ site, days, from, to }) => loglyApi(`/api/sites/${encodeURIComponent(site)}/breakdown`, range({ days, from, to })) - index.js:71-71 (schema)Input schema for logly_breakdown using Zod: requires 'site' (string), optional 'days' (positive int), optional 'from' (string YYYY-MM-DD), optional 'to' (string YYYY-MM-DD).
{ site: siteArg, days: daysArg, from: fromArg, to: toArg }, - index.js:30-33 (helper)The 'range()' helper function that constructs query parameters from days/from/to arguments, used by the logly_breakdown handler.
function range({ days, from, to }) { if (from || to) return { from, to }; return { days: days ?? 30 }; } - index.js:37-45 (helper)The 'tool()' helper function that wraps server.tool() with error handling, used to register logly_breakdown.
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 }; } }); }