Skip to main content
Glama

log

Create or update today's log file in MCP Notes, add notes, and tag content for easy organization and meaningful connections across your knowledge base.

Instructions

Create or update today's daily log file. Optionally add notes to the log.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
notesYes
tagsYesTags must follow these rules: - Can contain letters, numbers, underscore (_), hyphen (-), and forward slash (/) - Must contain at least one non-numerical character - Cannot contain spaces (use camelCase, PascalCase, snake_case, or kebab-case) - Are case-insensitive (stored as lowercase) Analyze the note's content and identify key themes, concepts, and categories that connect it to other notes. Consider: - Core topics and themes present in the note - Broader domains or areas of knowledge - Types of information (decisions, ideas, research, etc.) - Projects or contexts that might want to reference this later Do not force tags - only add ones that naturally emerge from the content and would help build meaningful connections between notes.

Implementation Reference

  • Main handler logic for the 'log' tool: instantiates LogNote, loads existing content, adds tags, appends timestamped entry, saves, and returns appropriate response or error.
    case "log": { try { const logArgs = args as LogArgs; // Create LogNote without tags first const logNote = new LogNote(notesPath); await logNote.load(); try { // Add tags separately to handle validation errors if (logArgs.tags && logArgs.tags.length > 0) { logNote.addTags(logArgs.tags); } const result = await logNote.appendEntry(logArgs.notes); if (!result.success) { return { content: [{ type: "text", text: `Error creating log: ${result.error}` }], isError: true, }; } return { content: [{ type: "text", text: `I've added your note to today's log at ${result.path}.` }], }; } catch (tagError) { // Specific handling for tag validation errors const errorMessage = tagError instanceof Error ? tagError.message : String(tagError); return { content: [{ type: "text", text: errorMessage }], isError: true, }; } } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error in log command: ${errorMessage}` }], isError: true, }; } }
  • Registration of the 'log' tool in getToolDefinitions(), including name, description, and input schema.
    { name: "log", description: "Create or update today's daily log file. Optionally add notes to the log.", inputSchema: { type: "object", properties: { notes: { type: "string" }, tags: { type: "array", items: { type: "string" }, description: `${TAG_VALIDATION_DESCRIPTION} Analyze the note's content and identify key themes, concepts, and categories that connect it to other notes. Consider: - Core topics and themes present in the note - Broader domains or areas of knowledge - Types of information (decisions, ideas, research, etc.) - Projects or contexts that might want to reference this later Do not force tags - only add ones that naturally emerge from the content and would help build meaningful connections between notes.` } }, required: ["notes", "tags"] } },
  • TypeScript interface defining the input arguments for the 'log' tool.
    interface LogArgs { notes: string; tags?: string[]; }
  • LogNote class providing the core implementation for managing daily log files: constructor sets path and template, addEntry appends timestamped entries, appendEntry handles loading/saving.
    export class LogNote extends Note { template: string; constructor(notesBasePath: string, options: LogNoteOptions = {}) { const date = options.date || new Date(); const dateInfo = { dayOfWeek: format(date, 'EEEE'), fullDate: format(date, 'MMMM d, yyyy'), isoDate: format(date, 'yyyy-MM-dd'), time: format(date, 'h:mm a') }; // Log notes always go in the Log directory with date-based filename const relativePath = path.join('Log', `${dateInfo.isoDate}.md`); super(notesBasePath, relativePath, { ...options, date }); this.template = `# ${this.dateInfo.dayOfWeek}, ${this.dateInfo.fullDate}\n\n`; } addEntry(entry: string): LogNote { // If note doesn't exist yet, initialize with template if (!this.exists && !this.content && this.template) { this.content = this.template; } // Generate a fresh timestamp for this entry const currentTime = format(new Date(), 'h:mm a'); // Add entry with fresh timestamp this.content += `\n### [${currentTime}]\n${entry}`; return this; } async appendEntry(entry: string) { // Load existing content if available if (!this.exists) { await this.load(); // If still no content, load template if (!this.template) { await this.loadTemplate(); } if (!this.content && this.template) { this.content = this.template; } } // Add the entry this.addEntry(entry); // Save the updated note return await this.save(); } // This method is referenced but not implemented in the original JS file // Adding it here for completeness async loadTemplate(): Promise<void> { try { // Implementation would depend on how templates are loaded // For now, we'll just use the default template this.template = `# ${this.dateInfo.dayOfWeek}, ${this.dateInfo.fullDate}\n\n`; } catch (error) { console.error("Error loading template:", error); } } }

Other Tools

Related Tools

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/mikeysrecipes/mcp-notes'

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