ask_webflow_ai
Get answers about Webflow API functionality and usage directly from AI assistance. Ask questions to understand how to interact with Webflow sites, pages, and collections through the API.
Instructions
Ask Webflow AI about anything related to Webflow API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes |
Implementation Reference
- src/tools/aiChat.ts:8-23 (registration)Registers the "ask_webflow_ai" MCP tool, defining its schema, description, and inline handler function that calls postChat and formats the response.export function registerAiChatTools(server: McpServer) { server.registerTool( "ask_webflow_ai", { title: "Ask Webflow AI", description: "Ask Webflow AI about anything related to Webflow API.", inputSchema: z.object({ message: z.string() }), }, async ({ message }) => { const result = await postChat(message); return { content: [{ type: "text", text: result }], }; } ); }
- src/tools/aiChat.ts:25-42 (helper)Core helper function that performs the HTTP POST request to Webflow's AI chat API endpoint, constructs the request body, and streams the response via streamToString.async function postChat(message: string) { const response = await fetch(`${BASE_URL}/api/fern-docs/search/v2/chat`, { method: "POST", headers: { "content-type": "application/json", "x-fern-host": X_FERN_HOST, }, body: JSON.stringify({ messages: [{ role: "user", parts: [{ type: "text", text: message }] }], conversationId: randomUUID(), url: BASE_URL, source: "mcp", }), }); const result = await streamToString(response); return result; }
- src/tools/aiChat.ts:44-60 (helper)Utility function to convert a streaming Fetch Response body into a complete string by reading chunks with TextDecoder.async function streamToString(response: Response) { const reader = response.body?.getReader(); if (!reader) { throw new Error("!reader"); } let result = ""; while (true) { const { done, value } = await reader.read(); if (done) break; // Convert the Uint8Array to a string and append result += new TextDecoder().decode(value); } return result; }
- src/mcp.ts:48-48 (registration)Calls registerAiChatTools to include the ask_webflow_ai tool in the main MCP server registration.registerAiChatTools(server);
- src/tools/aiChat.ts:14-14 (schema)Zod input schema for the tool: requires a 'message' string.inputSchema: z.object({ message: z.string() }),