logly_list_sites
Retrieve all websites from your Logly account along with their site IDs. Use this tool to get the site ID required for other Logly analytics tools.
Instructions
List every website in the authenticated Logly account with its site ID. Start here to find the site ID the other tools need.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:53-58 (handler)The 'logly_list_sites' tool is defined via the 'tool' helper function. The handler calls loglyApi('/api/sites') to list all websites in the Logly account.
tool( "logly_list_sites", "List every website in the authenticated Logly account with its site ID. Start here to find the site ID the other tools need.", {}, () => loglyApi("/api/sites") ); - index.js:37-44 (registration)The 'tool' helper function wraps server.tool() to register the tool with the MCP server, handling error wrapping and response formatting.
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)The loglyApi helper function handles API authentication and requests. For logly_list_sites, it is called with path '/api/sites' and no params.
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; } - index.js:56-56 (schema)The schema for logly_list_sites is an empty object {} — it takes no input parameters.
{},