Skip to content

fixes issue 39 #40

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

fixes issue 39 #40

wants to merge 2 commits into from

Conversation

valeriova96
Copy link

Fixes

1. updated the create_model_from_json_schema function in mcpadapt/src/mcpadapt/utils/modeling.py to ensure types like Literal and Enum are correctly preserved in the generated input schema used by the CrewAI adapter. Thus items and anyOf are added to Field object in process_schema function.

2. created resolve_refs_and_remove_defs function in mcpadapt/src/mcpadapt/utils/modeling.py to remove code-breaking $defs and $refs that are introduced when a custom class is used as one of the args type-hints. The function is called within mcpadapt/src/mcpadapt/crewai_adapter.py.

Contributors

Copy link
Owner

@grll grll left a comment

Choose a reason for hiding this comment

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

Overall this look good many thanks for the PR!
What I would just add is a couple of tests for both features it brings:

  1. one most simple test that would have failed under previous code for literal and enum
  2. one most simple test that would have failed under previous code with nested $refs

@valeriova96
Copy link
Author

Hey @grll — thanks for reviewing the PR!

I've implemented the changes you suggested. Specifically:

1. Added .DS_Store to .gitignore

2. Added two new pytest functions for crewai:

  • ✅ The first test fails if Union, Enum, or a Pydantic class are not properly imported into mcp_tool.inputSchema.

  • ✅ The second test triggers a KeyError if the script responsible for resolving $refs and removing $defs is not integrated into the mcp_tool.inputSchema generation process.

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.

3 participants