-
Notifications
You must be signed in to change notification settings - Fork 129
feat. support string format parameters #501
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
o-love
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like it would be better to choose just one approach, or a param model or flatten the options.
Having everything be optional can be confusing for the model and breaks the pydantic garentee.
I tried to have the Pydantic model flattened but fastmcp didn't like it.
On FastMcp's side, they seem to be against auto flattening.
See:
Maybe it could be easy to create our own decorator that flattens it?
cc @jealous
jealous
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Peter, could you please add new test cases in test_mcp_stdio.py? The arguments should be the new format. Thanks.
|
I am not sure how we can implement an auto flatten. Maybe we can investigate. |
|
It looks like this is a current issue with Claude code. It can be a future work |
|
@PeterZZZ , still has some format error and type error to fix. You can follow the logs in the action's output. |
Purpose of the change
This PR adds support for string-formatted parameters to improve compatibility with Claude Code and other MCP clients that pass parameters as JSON strings rather than pre-parsed objects.
Description
This change enhances the add_memory and search_memory tools to accept parameters in multiple formats:
Nested object format (existing): {"param": {"user_id": "user", "content": "..."}}
Flat format (new): {"user_id": "user", "content": "..."}
Fixes/Closes
Fixes # 476
#476
Type of change
[Please delete options that are not relevant.]
How Has This Been Tested?
Set up the MemMachine MCP server with Claude Code
Test add_memory with string-formatted parameters
Test search_memory with string-formatted parameters
Verify backward compatibility with existing object-based parameters
[Please delete options that are not relevant.]
Test Results: [Attach logs, screenshots, or relevant output]
✅ Successfully parses JSON string parameters
✅ Maintains backward compatibility with existing parameter formats
✅ Validation errors from Claude Code MCP integration resolved
[Please delete options that are not relevant.]