Add metadata_patch parameter for partial metadata updates#22
Merged
Conversation
Implement RFC 7396 JSON Merge Patch semantics for selective metadata updates. Adds new metadata_patch parameter to update_context tool that merges with existing metadata instead of replacing it. Supports adding, updating, and deleting keys (via null). Both SQLite (native json_patch) and PostgreSQL (custom jsonb_merge_patch function) backends are fully RFC 7396 compliant with deep merge for nested objects.
Add unit tests, integration tests, and real server tests for metadata_patch parameter. Tests cover basic operations, deep merge for nested objects, null-as-delete behavior, RFC 7396 limitations (array replacement), mutual exclusivity with metadata parameter, and edge cases.
Document the new metadata_patch parameter for update_context tool in README and metadata-filtering guide. Includes RFC 7396 JSON Merge Patch semantics, usage examples, known limitations (null-as-delete, array replacement), and comparison with full metadata replacement.
Update all 8 MCP tool descriptions in server.py following Anthropic's best practices for writing tools for agents. Add clear parameter documentation, usage guidance, constraints, and expected behaviors. Improves LLM ability to use tools correctly and efficiently.
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement RFC 7396 JSON Merge Patch semantics for selective metadata updates. Adds new metadata_patch parameter to
update_contexttool that merges with existing metadata instead of replacing it. Supports adding, updating, and deleting keys (via null). Both SQLite (nativejson_patch) and PostgreSQL (customjsonb_merge_patchfunction) backends are fully RFC 7396 compliant with deep merge for nested objects.