Refactor tool schemas to a single source of truth#369
Conversation
Move all tool schema definitions to a new `mnemosyne.tool_schemas` module to centralize management. Update `hermes_memory_provider` and the Hermes integration to import these definitions, ensuring backward compatibility.
AxDSan
left a comment
There was a problem hiding this comment.
Sorry for the delay, was IRL busy the last few days.
@rcsaquino the schema consolidation is the right call. Standalone mnemosyne mcp failing on tools/list because the import path went through mnemosyne_hermes (Hermes plugin context, not available in a fresh venv install) was a real packaging bug, and a single source of truth fixes it without leaving consumers to drift.
What I verified:
git diff main...pr/369 --stat-> 4 files, single newmnemosyne/tool_schemas.py(+708), consolidation inhermes_memory_provider/__init__.py(-582) andmnemosyne_hermes/tools.py(-624), smallmcp_tools.pytouch (-12). Net -480 LOC.py_compileclean on the newtool_schemas.pyand both updated provider inits.mnemosyne/mcp_tools.pynow imports frommnemosyne.tool_schemasinstead of tryingmnemosyne_hermes.toolswith a[]fallback. That fallback was the silent-failure path #360 hit.- Both provider inits still surface the same schema count (33) to Hermes registration. No behavior change at the tool-surface boundary.
- CI green: docs-check and test on 3.10/3.11/3.12/3.13 all SUCCESS.
One concern worth verifying: the new mnemosyne/tool_schemas.py is imported from three places (mnemosyne/mcp_tools.py, hermes_memory_provider/__init__.py, integrations/hermes/src/mnemosyne_hermes/tools.py). On standalone use (no Hermes plugin), only the first import matters; on Hermes provider mode, only the second or third. Worth confirming there is no circular import when both providers are present in the same process (some Hermes deployments load both surfaces).
LGTM with asks:
- Version bump. PR bumps to
3.10.1inmnemosyne/__init__.py, which I see already shipped via #373. If this lands after, confirm the next bump target (likely3.10.2since this is a refactor + bugfix combo, no new user-facing surface). If it lands before #373, just ride the3.10.1release. - CHANGELOG entry. Has one. Good.
Closes #360 cleanly. The schema source-of-truth pattern is exactly what should have been there from day one; thanks for the cleanup.
Summary
Fix standalone
mnemosyne mcp serverreturning empty tools list by centralizing all 33 tool schemas intomnemosyne.tool_schemas.Description
The standalone MCP server (
mnemosyne mcp) always returned{"tools": []}because mcp_tools.py imported schemas from the Hermes provider (mnemosyne_hermes/hermes_memory_provider) with a fallback to[]— neither is available outside the Hermes plugin context.Fix: create
mnemosyne/tool_schemas.pyas a self-contained schema module within the core package, and update all consumers (mcp_tools.py,hermes_memory_provider, Hermes integration) to import from this single source of truth. Net -480 linesRelated Issue
Closes #360
Type of Change
How Has This Been Tested?
Checklist
CHANGELOG.mdupdated with a brief entry