Commit f8495bb
fix(recall): align handler output with declared outputSchema (#46)
Three drifts between mcp_server/handlers/recall.py's outputSchema and
its handler implementation made every recall MCP call fail with
``Output validation error: 'memories' is a required property``:
1. Key names — handler returned ``results``/``total``/``query_intent``
while the schema required ``memories``/``count``/``intent``.
2. Intent enum — schema allowed 6 values but core.query_intent.QueryIntent
defines 11. Any query falling back to QueryIntent.GENERAL ("general")
would have failed enum validation even after the key rename.
3. Early return — the ``if not args or not args.get("query")`` branch
returned ``{"results": [], "total": 0}``, missing the
schema-required ``memories`` key entirely.
Fix:
• _handler_impl returns the schema-aligned ``memories``/``count``/
``intent`` keys AND keeps ``results``/``total``/``query_intent`` as
back-compat aliases for one minor release.
• Early return now includes the schema-required keys plus the
back-compat ones, so even no-query calls validate.
• outputSchema enum broadened to match QueryIntent's full set
(added: instruction, event_order, summarization, preference, general)
so the classifier's GENERAL fallback no longer fails MCP validation.
Two new tests prove the fix:
• test_issue_46_schema_aligned_keys — early-return + empty-query paths
carry the required keys.
• test_issue_46_intent_in_schema_enum — every public string constant on
QueryIntent must be in the broadened schema enum.
Reported by @darval. Verified locally; the broken pre-existing
test_recall_stored_memory unrelated to this fix (fails due to
sqlite_compat missing ``heat`` column — separate sweep).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a1a3c1b commit f8495bb
2 files changed
Lines changed: 86 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
68 | 79 | | |
69 | 80 | | |
70 | 81 | | |
| |||
262 | 273 | | |
263 | 274 | | |
264 | 275 | | |
265 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
266 | 286 | | |
267 | 287 | | |
268 | 288 | | |
| |||
315 | 335 | | |
316 | 336 | | |
317 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
318 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
319 | 349 | | |
320 | 350 | | |
321 | | - | |
322 | 351 | | |
| 352 | + | |
323 | 353 | | |
324 | 354 | | |
325 | 355 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
58 | 112 | | |
59 | 113 | | |
60 | 114 | | |
| |||
0 commit comments