Skip to content

Conversation

duguyue100
Copy link
Contributor

@duguyue100 duguyue100 commented Aug 22, 2025

Smolagents uses MCPAdapt, one problem is that it doesn't handle anyOf field from the input schema.

To mitigate this problem, I expanded get_tool_json_schema function that parses the argument properly.

Here is an example of before and after the change:
Before:

    'lifecycle_stage': {'anyOf': [{'enum': ['development',
        'ideation',
        'r_and_d',
        'testing',
        'production',
        'retired'],
       'type': 'string'},
      {'type': 'null'}],
     'default': None,
     'description': 'The lifecycle stage of the Software.',
     'title': 'Lifecycle Stage',
     'type': 'string'},

After

    'lifecycle_stage': {'default': None,
     'description': 'The lifecycle stage of the Software',
     'title': 'Lifecycle Stage',
     'type': 'string',
     'nullable': True,
     'enum': ['development',
      'ideation',
      'r_and_d',
      'testing',
      'production',
      'retired']},

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