logly_install_snippet
Generate the Logly tracking tag to add to a site's . Works offline without an API call.
Instructions
Return the Logly tracking snippet for a site — the single tag to add to the site's . Works offline, no API call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | Yes | Logly site ID (slug). Call logly_list_sites to discover it. |
Implementation Reference
- index.js:106-121 (handler)The tool handler for 'logly_install_snippet'. It returns a JSON string containing the site ID, the <script> snippet tag, and installation instructions. Works offline (no API call).
tool( "logly_install_snippet", "Return the Logly tracking snippet for a site — the single <script> tag to add to the site's <head>. Works offline, no API call.", { site: siteArg }, ({ site }) => JSON.stringify( { site, snippet: `<script src="https://logly.uk/p.js?s=${site}" data-site="${site}" async></script>`, instructions: "Add this tag inside the <head> of every page. It is a single cookie-free tag — no other setup needed.", }, null, 2 ) ); - index.js:37-45 (registration)The generic 'tool' wrapper function that registers each tool with the McpServer (line 38: server.tool(...)). This is how 'logly_install_snippet' gets registered.
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:47-47 (schema)The 'site' argument schema used by the tool — a string describing the Logly site ID (slug).
const siteArg = z.string().describe("Logly site ID (slug). Call logly_list_sites to discover it.");