docs: translate core API reference docs to English (#1693)#1793
docs: translate core API reference docs to English (#1693)#1793nuthalapativarun wants to merge 3 commits into
Conversation
MCP clients such as Cherry Studio always pass filter:{} in conversation
mode. FastMCP rejects unknown or invalid parameters, returning HTTP 400
"Invalid request parameters". Accept the filter parameter and normalise
an empty dict to None so the call succeeds.
Fixes MemTensor#1718
|
The CI Ruff checks are failing and need to be fixed before this can be merged:
Please run locally: poetry run ruff check --fix tests/api/test_mcp_serve.py
poetry run ruff format tests/api/test_mcp_serve.py |
|
Fixed the Ruff lint/format issues in tests/api/test_mcp_serve.py — CI should pass now. |
Memtensor-AI
left a comment
There was a problem hiding this comment.
Needs changes
The documentation translations look solid, but the code changes have a few issues worth addressing.
Code Issues
1. filter parameter accepted but never passed to mos_core.search() (bug)
src/memos/api/mcp_serve.py — The new filter parameter is normalized (empty dict → None), but then the actual self.mos_core.search(query, user_id, cube_ids) call on the next line never uses it. This means the filter is silently ignored at runtime.
if not filter:
filter = None
result = self.mos_core.search(query, user_id, cube_ids) # ← filter not passedEither pass filter to the search call or remove the parameter until the backend supports it. As-is, this gives users a false sense that filtering works via MCP.
2. Shadowing the built-in filter
The parameter name filter shadows Python's built-in. Consider search_filter or filter_conditions to avoid subtle bugs if the built-in is ever needed inside the function body.
3. Tests validate the current (broken) behavior
tests/api/test_mcp_serve.py — The tests assert mock_mos.search.assert_called_once_with("test query", None, None) which confirms filter is never forwarded. Once the bug above is fixed, these assertions will need updating. Also, the diff is truncated — test_search_memories_passes_user_and_cube_ids appears incomplete.
Documentation Nits
4. Broken admonition syntax — docs/en/.../get_memory.md line 82:
::note
Developer Tip: ... :::
This mixes two different admonition syntaxes. Should likely be :::note ... ::: (or whichever format the docs framework expects).
5. Dead link — docs/en/.../get_memory_by_id.md references [**Get Memory List**](./get_memory_list.md) but the actual file is named get_memory.md. This will 404.
Minor
- The PR description says "Documentation update" but includes a functional code change + new test file. The checklist item "I have added tests" is unchecked despite adding tests — worth ticking for clarity.
- Consider adding a test case where
filterhas actual content (e.g.,{"tags": {"contains": "x"}}) to verify it will be forwarded correctly once the bug is fixed.
Description
Translate the core API reference documentation from Chinese to English.
Files added:
docs/en/open_source/open_source_api/core/add_memory.mddocs/en/open_source/open_source_api/core/delete_memory.mddocs/en/open_source/open_source_api/core/get_memory.mddocs/en/open_source/open_source_api/core/get_memory_by_id.mddocs/en/open_source/open_source_api/core/search_memory.mdAPI paths, parameter names, JSON examples, and code blocks are unchanged. Only explanatory text is translated.
Related Issue (Required): Fixes #1693
Type of change
How Has This Been Tested?
Checklist