Skip to content

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.

fix: Preserve optional MCP input types (#6010)

Oleg Isonen6b82b413b9d8
diff --git a/packages/project-build/src/mcp.test.ts b/packages/project-build/src/mcp.test.ts
index bc6a311b83..3b81306dde 100644
--- a/packages/project-build/src/mcp.test.ts
+++ b/packages/project-build/src/mcp.test.ts
@@ -7482,7 +7482,22 @@ describe("project session mcp adapter", () => {
listedTools.tools.find(({ name }) => name === "list-pages")
?.inputSchema
).includeFolders
- ).toEqual({});
+ ).toEqual({ type: "boolean" });
+ expect(
+ getSchemaProperties(
+ listedTools.tools.find(({ name }) => name === "audit")?.inputSchema
+ )
+ ).toMatchObject({
+ cursor: { type: "string" },
+ limit: { type: "integer", minimum: 1, maximum: 200 },
+ verbose: { type: "boolean" },
+ });
+ expect(
+ getSchemaProperties(
+ listedTools.tools.find(({ name }) => name === "list-instances")
+ ?.inputSchema
+ ).maxDepth
+ ).toMatchObject({ type: "integer", minimum: 0 });
expect(
getSchemaProperties(
listedTools.tools.find(({ name }) => name === "publish")?.inputSchema
diff --git a/packages/project-build/src/mcp.ts b/packages/project-build/src/mcp.ts
index 592156c951..4f43fba34c 100644
--- a/packages/project-build/src/mcp.ts
+++ b/packages/project-build/src/mcp.ts
@@ -6307,15 +6307,7 @@ const getSdkInputSchema = (
required.has(name) ||
includeOptionalProperties ||
sdkDetailedOptionalSchemaProperties.has(name)
- ? [
- [
- name,
- required.has(name) ||
- sdkDetailedOptionalSchemaProperties.has(name)
- ? getSdkSchemaProperty(value)
- : {},
- ],
- ]
+ ? [[name, getSdkSchemaProperty(value)]]
: []
)
);