Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.
This repository was archived by the owner on Apr 13, 2026. It is now read-only.

cannot unmarshal bool into Go struct field #150

@djoreilly

Description

@djoreilly

Using gt=0 constraint on a int field, see here

from typing import Annotated
from pydantic import Field
from fastmcp import FastMCP

mcp = FastMCP("")

@mcp.tool
def process_image(
    width: Annotated[
        int, Field(description="Target width in pixels", gt=0, le=100)
    ] = 50,
) -> str:
    """Process an image with optional resizing."""
    return ""

Gives this:

Warning: Failed to load MCP server 'test-server': conv mcp tool input schema fail(unmarshal): json: cannot unmarshal bool into Go struct field .SchemaAlt.properties.SchemaAlt.exclusiveMinimum of type json.Number, tool name: process_image

   ERROR 

  Failed to create agent: failed to create agent: failed to load MCP tools: all MCP servers failed to load: server
  test-server: conv mcp tool input schema fail(unmarshal): json: cannot unmarshal bool into Go struct field
  .SchemaAlt.properties.SchemaAlt.exclusiveMinimum of type json.Number, tool name: process_image.

The error is coming from here.

This PR mentions exclusiveMinimum conversion getkin/kin-openapi#1102

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