get_website_analytics
Fetch website analytics data by providing the website ID. Access performance metrics and visitor insights to evaluate site performance.
Instructions
Get website analytics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| website_id | Yes | The website ID |
Implementation Reference
- server/index.js:446-449 (handler)The async handler function that executes the tool logic: calls the API endpoint /v1/workspace/website/{website_id}/analytics via GET and returns the data as JSON text content.
async ({ website_id }) => { const data = await apiCall(`/v1/workspace/website/${website_id}/analytics`, "GET"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } - server/index.js:442-444 (schema)Input schema for the tool: requires a 'website_id' string parameter.
{ website_id: z.string().describe("The website ID"), }, - server/index.js:439-450 (registration)Registration of the tool via server.tool() with name 'get_website_analytics' and description 'Get website analytics.'
server.tool( "get_website_analytics", "Get website analytics.", { website_id: z.string().describe("The website ID"), }, { title: "Get Website Analytics", readOnlyHint: true, destructiveHint: false, openWorldHint: false }, async ({ website_id }) => { const data = await apiCall(`/v1/workspace/website/${website_id}/analytics`, "GET"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } ); - server/index.js:112-123 (helper)The apiCall helper function used by the handler to make authenticated HTTP requests to the Lindo AI API.
async function apiCall(path, method, body) { const url = `${BASE_URL}${path}`; const res = await fetch(url, { method, headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json", }, ...(body ? { body: JSON.stringify(body) } : {}), }); return res.json(); }