create_daily_note
Generates a daily note in NotePlan by specifying a date (YYYY-MM-DD) and initial content, enabling users to organize tasks and ideas directly from Claude conversations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | No | Initial content for the daily note | |
| date | No | The date for the daily note (YYYY-MM-DD format) |
Implementation Reference
- src/services/noteService.ts:239-296 (handler)Core implementation of createDailyNote: creates a daily note file in NotePlan Calendar or mock DB, with default template if no content provided.function createDailyNote(options: CreateDailyNoteParams = {}): Note { const noteDate = options.date ? new Date(options.date) : new Date(); const dateStr = noteDate.toISOString().split('T')[0].replace(/-/g, ''); // YYYYMMDD format const noteId = `calendar-${dateStr}`; // Check if daily note already exists const existingNote = getNoteById(noteId); if (existingNote) { throw new Error(`Daily note for ${dateStr} already exists`); } const defaultTemplate = `# ${dateStr} ## Today's Plan - [ ] ## Notes ## Reflection --- Created: ${noteDate.toISOString()}`; const content = options.content || defaultTemplate; if (isNotePlanAvailable()) { // Write to actual NotePlan directory const filePath = path.join(CALENDAR_PATH, `${dateStr}.md`); try { fs.writeFileSync(filePath, content, 'utf8'); // Clear cache to force refresh notesCache = []; lastCacheUpdate = 0; // Return the newly created note return parseMarkdownFile(filePath, 'Calendar')!; } catch (error) { throw new Error(`Failed to create daily note: ${(error as Error).message}`); } } else { // Fallback to mock database const newNote: Note = { id: noteId, title: `Daily Note - ${dateStr}`, content, created: noteDate.toISOString(), modified: noteDate.toISOString(), folder: 'Calendar', type: 'daily' }; notesDb.push(newNote); return newNote; } }
- src/services/noteService.ts:27-30 (schema)TypeScript interface defining parameters for createDailyNote function.interface CreateDailyNoteParams { date?: string; content?: string; }
- src/index.ts:113-130 (registration)MCP server.tool registration for 'create_daily_note', with Zod input schema and handler delegating to noteService.createDailyNote.server.tool( 'create_daily_note', { date: z.string().optional().describe('The date for the daily note (YYYY-MM-DD format)'), content: z.string().optional().describe('Initial content for the daily note'), }, async ({ date, content }) => { const dailyNote = noteService.createDailyNote({ date, content }); return { content: [ { type: 'text', text: JSON.stringify(dailyNote, null, 2), }, ], }; } );