get_site
Retrieve detailed Webflow site information by ID, including workspace, creation date, display name, and publishing details for site management.
Instructions
Retrieve detailed information about a specific Webflow site by ID, including workspace, creation date, display name, and publishing details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siteId | Yes | The unique identifier of the Webflow site |
Implementation Reference
- src/index.ts:90-138 (handler)The asynchronous handler function for the 'get_site' tool. It validates input using Zod, fetches the site details from Webflow API, formats the response, and handles specific errors like site not found.get_site: async (args: unknown) => { const { siteId } = schemas.toolInputs.getSite.parse(args); try { const webflow = new WebflowClient({ accessToken }); const site = await webflow.sites.get(siteId); if (!site) { throw new Error("Site not found"); } const formattedSite = `• Site Details: ID: ${site.id} Display Name: ${site.displayName} Short Name: ${site.shortName} - Workspace Information: Workspace ID: ${site.workspaceId} - Dates: Created On: ${formatDate(site?.createdOn)} Last Published: ${formatDate(site?.lastPublished)} - URLs: Preview URL: ${site.previewUrl || "N/A"}`; return { content: [ { type: "text" as const, text: formattedSite, }, ], }; } catch (error: unknown) { if (isWebflowApiError(error) && error.code === "NOT_FOUND") { return { content: [ { type: "text" as const, text: `Site with ID ${siteId} not found.`, }, ], }; } console.error("Error fetching site:", error); throw new Error("Failed to fetch site details"); } },
- src/index.ts:61-75 (registration)The tool registration/definition for 'get_site' in the TOOL_DEFINITIONS array, which is returned by the listTools handler. Includes name, description, and JSON input schema.{ name: "get_site", description: "Retrieve detailed information about a specific Webflow site by ID, including workspace, creation date, display name, and publishing details", inputSchema: { type: "object", properties: { siteId: { type: "string", description: "The unique identifier of the Webflow site", }, }, required: ["siteId"], }, },
- src/index.ts:32-34 (schema)Zod schema used for input validation inside the get_site handler.getSite: z.object({ siteId: z.string().min(1, "Site ID is required"), }),
- src/index.ts:54-57 (helper)Helper utility function used to format dates in the site details response.function formatDate(date: Date | undefined | null): string { if (!date) return "N/A"; return date.toLocaleString(); }
- src/index.ts:50-52 (helper)Helper type guard function used to check for Webflow API errors in the handler.function isWebflowApiError(error: unknown): error is WebflowApiError { return error !== null && typeof error === "object" && "code" in error; }