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

Merged
merged 4 commits into from
May 15, 2025
Merged

fixes issue 39 #40

merged 4 commits into from
May 15, 2025

Conversation

valeriova96
Copy link
Contributor

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
Contributor 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.

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.

looks good if you can just remove the .DS_Store from git as well then we can merge. Many thanks!

.DS_Store Outdated
Copy link
Owner

Choose a reason for hiding this comment

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

the file is still there you need to remove it as well from the git history:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

and then commit / push again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 👍🏻

@grll
Copy link
Owner

grll commented May 13, 2025

also if you can quickly run the linter:
uv run ruff format .

@grll grll merged commit fe1b30c into grll:main May 15, 2025
3 checks passed
@grll
Copy link
Owner

grll commented May 15, 2025

Many thanks @valerio-valente-ist and team helping on this fix!

@grll
Copy link
Owner

grll commented May 15, 2025

I will release a new patch version later today

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