Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: require screenshot target in MCP schema (#6447)
Oleg Isonen6e174f46779d
diff --git a/packages/cli/src/commands/schema.test.ts b/packages/cli/src/commands/schema.test.tsindex bef957a81f..a109aca38d 100644--- a/packages/cli/src/commands/schema.test.ts+++ b/packages/cli/src/commands/schema.test.ts@@ -149,8 +149,8 @@ test("prints compact mcp tool summaries as json by default", () => {inputSchema,}));- // Includes the custom response headers schema in project settings updates.- expect(JSON.stringify(handshakePayload).length).toBeLessThan(220_000);+ // Includes the custom response headers and screenshot target schemas.+ expect(JSON.stringify(handshakePayload).length).toBeLessThan(221_000);expect(JSON.stringify(expectedTools.find(({ name }) => name === "insert-page-transfer-item")diff --git a/packages/project-build/src/mcp.test.ts b/packages/project-build/src/mcp.test.tsindex 9037255e5e..f040ba6e12 100644--- a/packages/project-build/src/mcp.test.ts+++ b/packages/project-build/src/mcp.test.ts@@ -6685,6 +6685,19 @@ describe("project session mcp adapter", () => {).rejects.toThrow("screenshot requires url or path.");});+ test("declares the screenshot target requirement in its MCP schema", () => {+ const screenshotTool = listProjectSessionMcpTools(publicMcpOperations, {+ includeScreenshot: true,+ }).find((tool) => tool.name === "screenshot");++ expect(screenshotTool?.inputSchema).toMatchObject({+ oneOf: expect.arrayContaining([+ expect.objectContaining({ required: ["url"] }),+ expect.objectContaining({ required: ["path"] }),+ ]),+ });+ });+test("rejects ambiguous screenshot base URL input", async () => {const adapter = createProjectSessionMcpCore({operations: publicMcpOperations,diff --git a/packages/project-build/src/mcp.ts b/packages/project-build/src/mcp.tsindex ce1cf3b0ac..180576182b 100644--- a/packages/project-build/src/mcp.ts+++ b/packages/project-build/src/mcp.ts@@ -1812,6 +1812,13 @@ const screenshotInputSchema = {items: { type: "string" },},},+ oneOf: [+ {+ required: ["url"],+ not: { anyOf: [{ required: ["path"] }, { required: ["baseUrl"] }] },+ },+ { required: ["path"], not: { required: ["url"] } },+ ],required: ["viewport"],} as const satisfies ProjectSessionMcpInputSchema;