getAllNotes
Retrieve all stored notes in JSON format using the Simple TypeScript MCP Server, enabling efficient access and management of note data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- src/server.ts:69-97 (handler)MCP tool handler for getAllNotes: retrieves all notes from notesStore, formats as JSON success response, or error response on failure.async () => { try { const notesList = notesStore.getAllNotes(); return { content: [ { type: "text", text: JSON.stringify({ success: true, notes: notesList }, null, 2) } ] }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: "Failed to retrieve notes" }, null, 2) } ] }; } },
- src/notes-store.ts:2-7 (schema)Type definition for Note objects returned by getAllNotes.export interface Note { id: string; title: string; content: string; createdAt: string; }
- src/server.ts:66-98 (registration)Full registration of the getAllNotes tool on the MCP server, specifying the tool name, empty input schema, and handler function.server.tool( "getAllNotes", {}, async () => { try { const notesList = notesStore.getAllNotes(); return { content: [ { type: "text", text: JSON.stringify({ success: true, notes: notesList }, null, 2) } ] }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: "Failed to retrieve notes" }, null, 2) } ] }; } }, );
- src/notes-store.ts:34-36 (helper)Core helper method in NotesStore class that implements the logic to retrieve all notes.getAllNotes(): Note[] { return Object.values(this.notes); }
- src/notes-store.ts:82-82 (helper)Singleton instance of NotesStore used by the tool handler.export const notesStore = new NotesStore();