Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions mempalace/mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def tool_status():
wings = {}
rooms = {}
try:
all_meta = col.get(include=["metadatas"], limit=10000)["metadatas"]
all_meta = col.get(include=["metadatas"], limit=max(col.count(), 1))["metadatas"]
for m in all_meta:
w = m.get("wing", "unknown")
r = m.get("room", "unknown")
Expand Down Expand Up @@ -201,7 +201,7 @@ def tool_list_wings():
return _no_palace()
wings = {}
try:
all_meta = col.get(include=["metadatas"], limit=10000)["metadatas"]
all_meta = col.get(include=["metadatas"], limit=max(col.count(), 1))["metadatas"]
for m in all_meta:
Comment on lines 203 to 205
w = m.get("wing", "unknown")
wings[w] = wings.get(w, 0) + 1
Expand All @@ -216,7 +216,7 @@ def tool_list_rooms(wing: str = None):
return _no_palace()
rooms = {}
try:
kwargs = {"include": ["metadatas"], "limit": 10000}
kwargs = {"include": ["metadatas"], "limit": max(col.count(), 1)}
if wing:
kwargs["where"] = {"wing": wing}
all_meta = col.get(**kwargs)["metadatas"]
Comment on lines 218 to 222
Expand All @@ -234,7 +234,7 @@ def tool_get_taxonomy():
return _no_palace()
taxonomy = {}
try:
all_meta = col.get(include=["metadatas"], limit=10000)["metadatas"]
all_meta = col.get(include=["metadatas"], limit=max(col.count(), 1))["metadatas"]
for m in all_meta:
w = m.get("wing", "unknown")
r = m.get("room", "unknown")
Expand Down Expand Up @@ -554,7 +554,7 @@ def tool_diary_read(agent_name: str, last_n: int = 10):
results = col.get(
where={"$and": [{"wing": wing}, {"room": "diary"}]},
include=["documents", "metadatas"],
limit=10000,
limit=max(col.count(), 1),
)

if not results["ids"]:
Expand Down
Loading