fix(mcp): route memory_recall through full search#532
Conversation
Signed-off-by: Lubrsy706 <lubrsy706@gmail.com>
|
@Lubrsy706 is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughRefactors memory_recall to validate token_budget, normalize format (full|compact|narrative), forward format/token_budget to the proxy (/agentmemory/search), add LocalMemory search helpers, implement format-aware local responses (compact list, narrative text, full observations), and update proxy and local tests. ChangesMemory_recall format and token_budget support
Sequence Diagram(s)sequenceDiagram
participant Client
participant MCP as MCP.handleProxy
participant AgentMemory as /agentmemory/search
Client->>MCP: memory_recall(query, limit, format, token_budget)
MCP->>AgentMemory: POST { query, limit, format, token_budget? }
AgentMemory-->>MCP: { format, text?, results }
MCP-->>Client: textResponse(proxyPayload, pretty=true)
sequenceDiagram
participant Client
participant MCPLocal as MCP.handleLocal
participant LocalMemory as searchLocalMemories
Client->>MCPLocal: memory_recall(query, limit, format)
MCPLocal->>LocalMemory: searchLocalMemories(queryWords, limit)
LocalMemory-->>MCPLocal: matched memories list
MCPLocal-->>Client: return compact list | narrative text | full observation objects
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/mcp/standalone.ts`:
- Around line 185-199: The handler currently accepts arbitrary args["format"]
and sets v.format, which lets a memory_smart_search request forward unsupported
formats upstream; enforce that when v.kind === "memory_smart_search" you ignore
or override any provided format and set v.format = "compact" (or remove/omit
format) so only compact is used, and ensure args["format"] processing (the block
referencing args["format"] / v.format) does not apply for memory_smart_search;
reference the symbols v.kind, v.format, and args["format"] to locate and change
the logic.
- Around line 190-199: The current validation checks `budget > 0` then assigns
`v.tokenBudget = Math.floor(budget)`, which allows sub-unit inputs like 0.5 to
become 0; change both branches to compute the floored value first and only
assign if that floored value is > 0: for the numeric branch compute floorN =
Math.floor(budget) and set `v.tokenBudget = floorN` only when floorN > 0; for
the string branch parse to n, compute floorN = Math.floor(n) and assign only
when floorN > 0, ensuring `v.tokenBudget` never becomes 0 from fractional inputs
while still accepting valid positive integer budgets.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 870fd25d-7a78-4cc8-9e78-5e1e1ee2b223
📒 Files selected for processing (2)
src/mcp/standalone.tstest/mcp-standalone-proxy.test.ts
Summary
memory_recallproxy calls to/agentmemory/searchinstead of/agentmemory/smart-searchformatandtoken_budgetsofull,compact, andnarrativerecall modes work as advertisedmemory_recallwith search-style responses while leavingmemory_smart_searchcompactFixes #507
Tests
npm test -- test/mcp-standalone-proxy.test.ts test/mcp-standalone.test.tsnpm run buildnpm testSummary by CodeRabbit
New Features
Behavior Changes
Tests