feat: Add JSON output mode for BM MCP tools (default text)#585
feat: Add JSON output mode for BM MCP tools (default text)#585phernandez merged 7 commits intomainfrom
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 3m 20s —— View job PR Review: Add JSON output mode for BM MCP toolsTasks:
SummaryThis PR adds Code Quality & Standards Checklist
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
Issues1. Hardcoded placeholder fields in
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d3e44e6151
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if output_format == "json": | ||
| return { | ||
| "deleted": result.failed_deletes == 0, | ||
| "is_directory": True, |
There was a problem hiding this comment.
Return JSON for directory-delete failures
When output_format="json" is requested for directory deletes, only the success path returns a dict; if knowledge_client.delete_directory() raises (for example, missing directory or permission errors), the handler below still returns a markdown string. That mixed return type will break callers that unconditionally parse JSON in error scenarios, which is exactly when machine-readable output is most needed.
Useful? React with 👍 / 👎.
| if primary.type != "entity": | ||
| continue |
There was a problem hiding this comment.
Preserve requested activity types in JSON mode
recent_activity accepts type filters for entity, relation, and observation, but the new JSON flattening helper drops every non-entity item. As a result, calls like recent_activity(type="relation", output_format="json") can return empty/incomplete data even when matching relations exist, so downstream tools get incorrect results.
Useful? React with 👍 / 👎.
Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 2m 33s —— View job PR Review: Add JSON output mode for BM MCP toolsTasks:
SummaryThis PR adds There are several issues that warrant attention before merge, including one real bug in JSON mode for Code Quality & Standards Checklist
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
Issues1. Bug:
|
Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 3m 37s —— View job PR Review: Add JSON output mode for BM MCP toolsTasks:
SummaryThis PR is in good shape. The latest commit (
There are 3 remaining issues that should be addressed before merge: one bug (escaped newline), one dead-code concern, and one hardcoded placeholder schema concern. Code Quality & Standards Checklist
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
Remaining Issues1. Bug: Escaped newline in
|
Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 2m 54s —— View job PR Review: Add JSON output mode for BM MCP toolsTasks:
SummaryThe latest commit ( Status of Previous Review Issues✅ Fixed: Escaped newline in
|
Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 2m 26s —— View job PR Review: Add JSON output mode for BM MCP toolsTasks:
SummaryThe latest commit ( Additionally, the tests were updated to align with the JSON dict contract — mocks now return plain This PR is nearly ready for merge. One minor coverage concern remains. Status of Final Remaining Issue✅ Fixed:
|
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: Paul Hernandez <60959+phernandez@users.noreply.github.com>
|
Claude finished @phernandez's task in 1m 45s —— View job PR Review: Add JSON output mode for BM MCP toolsTasks:
SummaryThe latest commit ( Combined with Final Status of All Issues
Code Quality & Standards Checklist
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
Conclusion: This PR is clean and ready to merge. All issues identified across five review rounds have been resolved. The JSON output contract is well-defined, backward compatibility is preserved for text-mode callers, and the test suite fully covers the new behavior. |
|
Claude finished @phernandez's task in 1m 53s —— View job PR Review: Add JSON output mode for BM MCP toolsTasks:
SummaryThis PR is clean and ready to merge. All issues raised across the previous five review rounds have been addressed. The latest commit ( Final Checklist Status
Code Quality & Standards Checklist
Testing & Documentation
Basic Memory Architecture
Security & Performance
Compatibility
One Minor Observation (non-blocking)
Conclusion: All merge-blocking issues from all previous review rounds have been resolved. This PR is ready to merge. |
Summary
output_formatsupport ("text" | "json", default"text") across BM MCP tools used by openclaw-basic-memoryoutput_format="text"output_format="json"for:read_note,write_note,edit_note,recent_activitylist_memory_projects,create_memory_projectdelete_note,move_noteoutput_formattobuild_contextfor interface consistencycreate_memory_projectbehavior withalready_exists=trueon repeated callsTests
just typecheckjust test-sqliteNotes
codex/mcp-output-format-json-pr) based onorigin/mainto keep unrelated commits out of this PR.