Skip to content

Throw bespoke error on incorrectly defined schemas with "z.string().describe()" #121

@PaulRBerg

Description

@PaulRBerg

I used an LLM to vibe code my first MCP Framework, and the LLM defined the schema like so:

schema = {
    repository: z.string().describe("Repository name, e.g., 'lockup'"),
  };

Then, I was getting this bug when running the MCP server: #120

The LLM was unable to figure out why it was not working.

The issue was that I had defined the schema like so:

schema = {
  repository: z.string().describe("Repository name, e.g., 'lockup'"),
};

When I should have defined it like so:

schema = {
  repository: {
    description: "Repository name, e.g., 'lockup'",
    type: z.string(),
  },
};

This is something that can be caught at compile time. A bespoke error can be thrown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions