fix(mcp): expose edit_note operation enum - #1037
Merged
Merged
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
14 tasks
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.
Why
edit_note.operationas a free-form string even though Basic Memory only supports a fixed set of edit operations.What Changed
EDIT_OPERATIONSsource of truth insrc/basic_memory/mcp/tools/edit_note.py.edit_note.operationparameter with JSON schema enum metadata while keeping the existing string runtime validation.edit_note.operationschema advertises the supported enum values.Implementation Details
strinstead of aLiteralso direct Python callers, CLI paths, and invalid-operation tests do not need casts.Field(json_schema_extra={"enum": ...}), which FastMCP includes intools/listwhile preserving the existing docstring-derived description.Testing
Automated
uv run pytest tests/mcp/test_tool_contracts.py -q: passed, 4 passed.just fast-check: passed; cold testmon selected a broad run, 3397 passed, 43 skipped, 20 warnings.uv run ruff check src/basic_memory/mcp/tools/edit_note.py tests/mcp/test_tool_contracts.py: passed.uv run ruff format --check src/basic_memory/mcp/tools/edit_note.py tests/mcp/test_tool_contracts.py: passed.uv run ty check src tests test-int: passed.Manual
mcp.list_tools()foredit_noteand confirmedinputSchema.properties.operation.enumcontainsappend,prepend,find_replace,replace_section,insert_before_section, andinsert_after_section.Risks / Follow-ups
basic-memorydependency so the hosted MCP endpoint advertises the new schema.