Skip to main content
Glama

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
NameRequiredDescriptionDefault
idNoNote ID (omit to create new)
titleYesNote title
contentYesFull note content (markdown supported)
note_typeNogeneral
related_entity_typeNoLink note to an entity
related_entity_idNoID of the related entity
tagsNo

Implementation Reference

  • 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;
      }
    }
  • 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'],
        },
      },
  • 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,
    };

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/spranab/saga-mcp'

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