Skip to content

Commit 67d732c

Browse files
committed
Address PR review comments
1. Fix string consistency in FT.AGGREGATE query parameters - now all numeric parameters are explicitly converted to strings using str() 2. Handle tool messages and other unknown roles in memory_prompt API - treat non-user/assistant roles as assistant messages for MCP compatibility since MCP base only supports UserMessage and AssistantMessage types
1 parent 55ea2ef commit 67d732c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

agent_memory_server/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,13 @@ async def memory_prompt(
637637
for msg in recent_messages:
638638
if msg.role == "user":
639639
msg_class = base.UserMessage
640+
elif msg.role == "assistant":
641+
msg_class = base.AssistantMessage
640642
else:
643+
# For tool messages or other roles, treat as assistant for MCP compatibility
644+
# since MCP base only supports UserMessage and AssistantMessage
641645
msg_class = base.AssistantMessage
646+
642647
_messages.append(
643648
msg_class(
644649
content=TextContent(type="text", text=msg.content),

agent_memory_server/long_term_memory.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,21 +329,21 @@ async def compact_long_term_memories(
329329
index_name,
330330
filter_str,
331331
"GROUPBY",
332-
"1",
332+
str(1),
333333
"@memory_hash",
334334
"REDUCE",
335335
"COUNT",
336-
"0",
336+
str(0),
337337
"AS",
338338
"count",
339339
"FILTER",
340340
"@count>1", # Only groups with more than 1 memory
341341
"SORTBY",
342-
"2",
342+
str(2),
343343
"@count",
344344
"DESC",
345345
"LIMIT",
346-
"0",
346+
str(0),
347347
str(limit),
348348
]
349349

0 commit comments

Comments
 (0)