Skip to content

Conversation

@1MoreBuild
Copy link
Contributor

@1MoreBuild 1MoreBuild commented Dec 13, 2025

Summary

Fixes #281

  • Fix MCP tool get_ai_elements_component not exposing the component parameter in inputSchema
  • Use zod/v3 import for backward compatibility with mcp-handler's internal zod-to-json-schema
  • Replace z.enum() with z.string().describe() for better schema generation

Problem

The mcp-handler package internally depends on @modelcontextprotocol/sdk@1.22.0, which uses zod-to-json-schema that is incompatible with Zod 4. This caused the component parameter to not be exposed in the tool's inputSchema (empty properties object), resulting in error: MCP error -32603: t._parse is not a function.

Before fix:

{
  "name": "get_ai_elements_component",
  "inputSchema": {
    "properties": {}  // component parameter missing!
  }
}

After fix:

{
  "name": "get_ai_elements_component", 
  "inputSchema": {
    "properties": {
      "component": {
        "type": "string",
        "description": "Component name. Available: artifact, canvas, ..."
      }
    },
    "required": ["component"]
  }
}

Test plan

  • Verified tools/list returns correct inputSchema with component parameter
  • Verified tools/call for get_ai_elements_component works correctly
  • Tested with MCP Inspector using Streamable HTTP transport

@vercel
Copy link
Contributor

vercel bot commented Dec 13, 2025

Someone is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

The mcp-handler package internally depends on @modelcontextprotocol/sdk@1.22.0,
which uses zod-to-json-schema that is incompatible with Zod 4. This caused
the `component` parameter in `get_ai_elements_component` tool to not be
exposed in the inputSchema (empty properties object).

Changes:
- Import zod from "zod/v3" instead of "zod" for backward compatibility
- Replace z.enum() with z.string().describe() for better schema generation
- Improve error message to list available components when not found
@1MoreBuild 1MoreBuild force-pushed the fix/mcp-zod4-compatibility branch from 4192629 to 934eb0c Compare December 13, 2025 22:36
@haydenbleasel
Copy link
Member

Appreciate it @1MoreBuild! 🙏

@haydenbleasel haydenbleasel merged commit f0625b5 into vercel:main Dec 19, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Server tool get_ai_elements_component is not working?

2 participants