Skip to main content
Glama

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).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationNo
contentNo
tagsNo
importanceNomedium
queryNo
tagFilterNo
noteIdNo
limitNo

Implementation Reference

  • 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); } }, },
  • 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, ]);
  • 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) }] }; } }
  • In-memory storage Map for session notes, used by all note operations.
    const notesStore = new Map<string, Note>();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mnehmos/ChatRPG'

If you have feedback or need assistance with the MCP directory API, please join our Discord server