Skip to content

Commit 4f7023a

Browse files
committed
fix(client): Use paging to fetch all notes
1 parent 8f6656c commit 4f7023a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

nextcloud_mcp_server/client/notes.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,21 @@ async def get_settings(self) -> Dict[str, Any]:
1818

1919
async def get_all_notes(self) -> List[Dict[str, Any]]:
2020
"""Get all notes."""
21-
response = await self._make_request("GET", "/apps/notes/api/v1/notes")
22-
return response.json()
21+
notes = []
22+
cursor = ""
23+
24+
while True:
25+
response = await self._make_request(
26+
"GET",
27+
"/apps/notes/api/v1/notes",
28+
params={"chunkSize": 50, "chunkCursor": cursor},
29+
)
30+
notes.extend(response.json())
31+
if "X-Notes-Chunk-Cursor" not in response.headers:
32+
break
33+
cursor = response.headers["X-Notes-Chunk-Cursor"]
34+
35+
return notes
2336

2437
async def get_note(self, note_id: int) -> Dict[str, Any]:
2538
"""Get a specific note by ID."""

0 commit comments

Comments
 (0)