logly_funnels
List conversion funnels defined for a site, showing funnel IDs and step sequences for user journey analysis.
Instructions
List the conversion funnels defined for a site, with their IDs and step sequences.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site | Yes | Logly site ID (slug). Call logly_list_sites to discover it. |
Implementation Reference
- index.js:91-96 (handler)The tool 'logly_funnels' handler function. It takes a site ID and calls the Logly API endpoint /api/sites/{site}/funnels to list conversion funnels defined for a site, returning their IDs and step sequences.
tool( "logly_funnels", "List the conversion funnels defined for a site, with their IDs and step sequences.", { site: siteArg }, ({ site }) => loglyApi(`/api/sites/${encodeURIComponent(site)}/funnels`) ); - index.js:91-96 (registration)The tool is registered using a custom 'tool' helper function (defined at line 37) which wraps server.tool() from the MCP SDK. The registration includes the name 'logly_funnels', description, input schema (site string), and the handler.
tool( "logly_funnels", "List the conversion funnels defined for a site, with their IDs and step sequences.", { site: siteArg }, ({ site }) => loglyApi(`/api/sites/${encodeURIComponent(site)}/funnels`) ); - index.js:91-96 (schema)Input schema for 'logly_funnels': requires a single 'site' parameter (string, described as 'Logly site ID (slug)') sourced from the shared siteArg constant defined at line 47.
tool( "logly_funnels", "List the conversion funnels defined for a site, with their IDs and step sequences.", { site: siteArg }, ({ site }) => loglyApi(`/api/sites/${encodeURIComponent(site)}/funnels`) ); - index.js:8-27 (helper)The 'loglyApi' helper function is used by the handler to make authenticated HTTP requests to the Logly API. It reads the LOGLY_API_KEY from environment, builds the URL with query parameters, and returns the response text.
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; }