get_sites
Retrieve all Webflow sites accessible to your authenticated account to manage and view your portfolio.
Instructions
Retrieve a list of all Webflow sites accessible to the authenticated user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:140-181 (handler)The main handler function for the 'get_sites' tool. It uses WebflowClient to list all sites, formats them with details like ID, name, workspace, dates, and preview URL, and returns formatted text content.get_sites: async () => { try { const webflow = new WebflowClient({ accessToken }); const { sites } = await webflow.sites.list(); if (!Array.isArray(sites) || sites.length === 0) { return { content: [ { type: "text" as const, text: "No sites found for this account.", }, ], }; } const formattedSites = sites .map( (site) => ` • Site: ${site.displayName} - ID: ${site.id} - Workspace: ${site.workspaceId} - Created: ${formatDate(site?.createdOn)} - Last Published: ${formatDate(site?.lastPublished)} - Preview URL: ${site.previewUrl || "N/A"} ` ) .join("\n"); return { content: [ { type: "text" as const, text: `Found ${sites.length} sites:\n${formattedSites}`, }, ], }; } catch (error: unknown) { console.error("Error fetching sites:", error); throw new Error("Failed to fetch sites list"); } },
- src/index.ts:76-85 (registration)Tool registration entry in TOOL_DEFINITIONS array, which is returned in response to ListToolsRequest. Includes name, description, and empty input schema.{ name: "get_sites", description: "Retrieve a list of all Webflow sites accessible to the authenticated user", inputSchema: { type: "object", properties: {}, required: [], }, },
- src/index.ts:35-35 (schema)Zod schema definition for get_sites tool input validation (accepts no parameters).getSites: z.object({}),
- src/index.ts:54-57 (helper)Utility helper function used by the get_sites handler to format creation and last published dates.function formatDate(date: Date | undefined | null): string { if (!date) return "N/A"; return date.toLocaleString(); }