manage_notes
Add, search, retrieve, and delete session notes with content, tags, and importance levels for organized role-playing game management.
Instructions
Manage session notes. Operations: add (add note with content/tags/importance), search (search by query/tagFilter), get (get by noteId), delete (remove by noteId), list (list recent with limit).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "manage_notes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | No | ||
| content | No | ||
| tags | No | ||
| importance | No | medium | |
| query | No | ||
| tagFilter | No | ||
| noteId | No | ||
| limit | No |
Implementation Reference
- src/registry.ts:1116-1133 (registration)Registration of the manage_notes tool in the central registry, linking to manageNotes handler and manageNotesSchema.
manage_notes: { name: 'manage_notes', description: 'Manage session notes. Operations: add (add note with content/tags/importance), search (search by query/tagFilter), get (get by noteId), delete (remove by noteId), list (list recent with limit).', inputSchema: toJsonSchema(manageNotesSchema), handler: async (args) => { try { const result = await manageNotes(args); return result; } catch (err) { if (err instanceof z.ZodError) { const messages = err.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', '); return error(`Validation failed: ${messages}`); } const message = err instanceof Error ? err.message : String(err); return error(message); } }, }, - src/modules/data.ts:2313-2354 (schema)Zod schemas defining input validation for manage_notes tool operations: add, search, get, delete, list. Combined into discriminatedUnion on 'operation' field.
/** Add operation schema */ const addNoteOperationSchema = z.object({ operation: z.literal('add'), content: z.string().min(1, 'Content is required'), tags: z.array(z.string()).optional(), importance: ImportanceSchema.optional().default('medium'), }); /** Search operation schema */ const searchNoteOperationSchema = z.object({ operation: z.literal('search'), query: z.string().optional(), tagFilter: z.array(z.string()).optional(), }); /** Get operation schema */ const getNoteOperationSchema = z.object({ operation: z.literal('get'), noteId: z.string(), }); /** Delete operation schema */ const deleteNoteOperationSchema = z.object({ operation: z.literal('delete'), noteId: z.string(), }); /** List operation schema */ const listNoteOperationSchema = z.object({ operation: z.literal('list'), limit: z.number().int().min(1).optional(), }); /** Combined schema for manage_notes using discriminatedUnion */ export const manageNotesSchema = z.discriminatedUnion('operation', [ addNoteOperationSchema, searchNoteOperationSchema, getNoteOperationSchema, deleteNoteOperationSchema, listNoteOperationSchema, ]); - src/modules/data.ts:2535-2577 (handler)Primary handler function for the manage_notes tool. Parses input with manageNotesSchema, dispatches to operation-specific handlers (handleNoteAdd, handleNoteSearch, etc.), formats output using createBox, and handles errors.
export async function manageNotes(input: unknown): Promise<{ content: { type: 'text'; text: string }[] }> { try { const parsed = manageNotesSchema.parse(input); let result: string; switch (parsed.operation) { case 'add': result = handleNoteAdd(parsed); break; case 'search': result = handleNoteSearch(parsed); break; case 'get': result = handleNoteGet(parsed); break; case 'delete': result = handleNoteDelete(parsed); break; case 'list': result = handleNoteList(parsed); break; default: result = createBox('ERROR', ['Unknown operation'], DISPLAY_WIDTH); } return { content: [{ type: 'text' as const, text: result }] }; } catch (error) { const lines: string[] = []; if (error instanceof z.ZodError) { for (const issue of error.issues) { lines.push(`${issue.path.join('.')}: ${issue.message}`); } } else if (error instanceof Error) { lines.push(error.message); } else { lines.push('An unknown error occurred'); } return { content: [{ type: 'text' as const, text: createBox('ERROR', lines, DISPLAY_WIDTH) }] }; } } - src/modules/data.ts:2307-2308 (helper)In-memory storage Map for session notes, used by all note operations.
const notesStore = new Map<string, Note>();