Skip to content

Support multiple types in tool arguments validation #1505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

duguyue100
Copy link
Contributor

@duguyue100 duguyue100 commented Jun 30, 2025

Here is the problem: I have an MCP server that is generated from an OpenAPI specification. In one of the input arguments of a tool, it has the type [str, null]. In the argument validation, smolagents only allows a single type for each input argument. This small PR fixes this small issue.

Other docstring changes are from my ruff formatter.

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Good to add support for type as a list.

I added some tests and included a validation of type when it is not a string nor a list of strings.

For the issue with your ruff formatter, next time you need to call make style instead.

@albertvillanova albertvillanova merged commit 3992f88 into huggingface:main Jul 1, 2025
3 checks passed
@duguyue100
Copy link
Contributor Author

Thanks for fixing this, much better

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.

2 participants