MCPcopy
hub / github.com/codedogQBY/ReadAny / getAllNotes

Function getAllNotes

packages/core/src/db/note-queries.ts:43–69  ·  view source on GitHub ↗
(limit = 50)

Source from the content-addressed store, hash-verified

41
42/** Get all notes across all books (for general chat without bookId) */
43export async function getAllNotes(limit = 50): Promise<Note[]> {
44 const database = await getDB();
45 const rows = await database.select<{
46 id: string;
47 book_id: string;
48 highlight_id: string | null;
49 cfi: string | null;
50 title: string;
51 content: string;
52 chapter_title: string | null;
53 tags: string;
54 created_at: number;
55 updated_at: number;
56 }>("SELECT * FROM notes ORDER BY created_at DESC LIMIT ?", [limit]);
57 return rows.map((r) => ({
58 id: r.id,
59 bookId: r.book_id,
60 highlightId: r.highlight_id || undefined,
61 cfi: r.cfi || undefined,
62 title: r.title,
63 content: r.content,
64 chapterTitle: r.chapter_title || undefined,
65 tags: parseJSON(r.tags, []),
66 createdAt: r.created_at,
67 updatedAt: r.updated_at,
68 }));
69}
70
71export async function insertNote(note: Note): Promise<void> {
72 const database = await getDB();

Callers 2

createSearchAllNotesToolFunction · 0.85

Calls 3

getDBFunction · 0.90
parseJSONFunction · 0.90
mapMethod · 0.80

Tested by

no test coverage detected