note_save
Create or update notes to capture decisions, context, progress, meeting details, blockers, technical information, or release data within a structured project tracking system.
Instructions
Create or update a note. Notes capture decisions, context, progress, meeting notes, blockers, technical details, or release info. If "id" is provided, updates the existing note; otherwise creates a new one.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Note ID (omit to create new) | |
| title | Yes | Note title | |
| content | Yes | Full note content (markdown supported) | |
| note_type | No | general | |
| related_entity_type | No | Link note to an entity | |
| related_entity_id | No | ID of the related entity | |
| tags | No |
Implementation Reference
- src/tools/notes.ts:84-122 (handler)The handleNoteSave function implements the logic for creating or updating a note in the database.
function handleNoteSave(args: Record<string, unknown>) { const db = getDb(); const id = args.id as number | undefined; const title = args.title as string; const content = args.content as string; const noteType = (args.note_type as string) ?? 'general'; const relatedEntityType = (args.related_entity_type as string) ?? null; const relatedEntityId = (args.related_entity_id as number) ?? null; const tags = JSON.stringify((args.tags as string[]) ?? []); if (id !== undefined) { // Update existing note const existing = db.prepare('SELECT * FROM notes WHERE id = ?').get(id); if (!existing) throw new Error(`Note ${id} not found`); const note = db .prepare( `UPDATE notes SET title = ?, content = ?, note_type = ?, related_entity_type = ?, related_entity_id = ?, tags = ?, updated_at = datetime('now') WHERE id = ? RETURNING *` ) .get(title, content, noteType, relatedEntityType, relatedEntityId, tags, id); logActivity(db, 'note', id, 'updated', null, null, null, `Note '${title}' updated`); return note; } else { // Create new note const note = db .prepare( `INSERT INTO notes (title, content, note_type, related_entity_type, related_entity_id, tags) VALUES (?, ?, ?, ?, ?, ?) RETURNING *` ) .get(title, content, noteType, relatedEntityType, relatedEntityId, tags); const row = note as Record<string, unknown>; logActivity(db, 'note', row.id as number, 'created', null, null, null, `Note '${title}' created`); return note; } } - src/tools/notes.ts:7-34 (schema)The tool definition including input schema for note_save.
export const definitions: Tool[] = [ { name: 'note_save', description: 'Create or update a note. Notes capture decisions, context, progress, meeting notes, blockers, technical details, or release info. If "id" is provided, updates the existing note; otherwise creates a new one.', annotations: { title: 'Save Note', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }, inputSchema: { type: 'object', properties: { id: { type: 'integer', description: 'Note ID (omit to create new)' }, title: { type: 'string', description: 'Note title' }, content: { type: 'string', description: 'Full note content (markdown supported)' }, note_type: { type: 'string', enum: ['general', 'decision', 'context', 'meeting', 'technical', 'blocker', 'progress', 'release'], default: 'general', }, related_entity_type: { type: 'string', enum: ['project', 'epic', 'task'], description: 'Link note to an entity', }, related_entity_id: { type: 'integer', description: 'ID of the related entity' }, tags: { type: 'array', items: { type: 'string' } }, }, required: ['title', 'content'], }, }, - src/tools/notes.ts:193-198 (registration)Registration of the note_save tool handler within the handlers object.
export const handlers: Record<string, ToolHandler> = { note_save: handleNoteSave, note_list: handleNoteList, note_search: handleNoteSearch, note_delete: handleNoteDelete, };