Skip to content

Add metadata_patch parameter for partial metadata updates#22

Merged
alex-feel merged 5 commits into
mainfrom
alex-feel-dev
Nov 29, 2025
Merged

Add metadata_patch parameter for partial metadata updates#22
alex-feel merged 5 commits into
mainfrom
alex-feel-dev

Conversation

@alex-feel

Copy link
Copy Markdown
Owner

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.

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.
@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  app
  server.py 347, 369-460, 485-491
  app/repositories
  context_repository.py 767, 807-890
Project Total  

This report was generated by python-coverage-comment-action

@alex-feel alex-feel merged commit 116077b into main Nov 29, 2025
6 checks passed
@alex-feel alex-feel deleted the alex-feel-dev branch November 29, 2025 15:40
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