Skip to content

Failed building the serialization schema for GET #808

@punkpeye

Description

@punkpeye

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

5.6.2

Plugin version

No response

Node.js version

24

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

26.0

Description

Unclear why this suddenly started to throw an error.

FastifyError: Failed building the serialization schema for GET: /api/mcp/v1/servers, due to error Zod schema of type `custom` at properties > zodOpenApiCreateSchema > properties > servers > items > properties > tools > items > properties > inputSchema cannot be represented in OpenAPI. Please assign it metadata with `.meta()`

Link to code that reproduces the bug

N/A

Expected Behavior

I should be able to use custom types.

const McpServerToolModelZodSchema = z
  .object({
    description: z.string().nullable(),
    inputSchema: z.custom<JSONSchema7Object>().meta({
       description: 'MCP server tool input schema',
    }),
    name: z.string(),
  })
  .meta({
    description: 'MCP server tool',
    ref: 'McpServerTool',
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions