Commit 7e6f7b2
fix: propagate EmbeddingModelMismatchError through MCP tools
@NickShtefan fixed the CLI path in PR MemPalace#442 (searcher.py) by re-raising
EmbeddingModelMismatchError past the generic except clause. The MCP
path had the same bug via two additional swallows:
- mcp_server.py:_get_collection() wraps _palace_get_collection in
except Exception: return None, so every tool using _get_collection
(status, list_wings, list_rooms, get_taxonomy, check_duplicate,
search, etc.) silently showed "No palace found" instead of the
actual mismatch error.
- The top-level dispatcher in handle_request() catches Exception and
returns hardcoded "Internal tool error", so even if the wrapper
re-raises, the actionable message (stored vs current model + recovery
instructions) never reaches the caller.
Fix in three spots:
1. searcher.py: re-raise EmbeddingModelMismatchError in search() and
search_memories() before the generic except (matches @NickShtefan's fix).
2. mcp_server.py:_get_collection(): re-raise EmbeddingModelMismatchError
before the generic swallow.
3. mcp_server.py handle_request(): catch EmbeddingModelMismatchError
explicitly and return the message as a JSON result so MCP clients
see the real error and recovery instructions.1 parent 1e00e19 commit 7e6f7b2
1 file changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
| 119 | + | |
| 120 | + | |
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
| |||
981 | 988 | | |
982 | 989 | | |
983 | 990 | | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
984 | 1002 | | |
985 | 1003 | | |
986 | 1004 | | |
| |||
0 commit comments