Skip to content

input schema: anyOf integer, string not handled correctlyΒ #915

@ilia-kats

Description

@ilia-kats

Inspector Version

  • 0.17.2

Describe the bug
I have a tool that accepts either an integer or a string for one of its parameters. I'm using FastMCP in Python, and the function signature looks something like this:

def my_tool(arg1: Annotated[FilePath, Field(description="...")], factor: Annotated[str | Annotated[int, Field(ge=1)], Field(description="...")]=1) -> ToolResult

The produced input schema looks fine:

"factor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "minimum": 1,
                "type": "integer"
              }
            ],
            "default": 1,
            "description": "..."
          }

However, the input field shown in the inspector does not show the description and appears to only accept integers, if I input something that cannot be parsed as integer I get an error message JSON.parse: unexpected character at line 1 column 1 of the JSON data.

Image

Environment (please complete the following information):

  • OS: Linux
  • Browser: Firefox

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtoolsIssues related to testing tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions