Skip to content

Conversation

electrocucaracha
Copy link

Considering the following scenario:

@mcp.tool()
def echo_tool(id: int|None, text: str = Field(description="The text to echo")) -> str:
...

Which results in this input schema

{'properties': {'id': {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'title': 'Id'}, 'text': {'description': 'The text to echo', 'title': 'Text', 'type': 'string'}}, 'required': ['id', 'text'], 'title': 'echo_toolArguments', 'type': 'object'}

Where the id field is required but nullable at the same time.

For this scenario, the field needs to be interpreted as Python Optional field. This PR allows that case.

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.

1 participant