get_entry_by_date
Retrieve a personal journal entry for a specific date using YYYY-MM-DD format to access past reflections and records.
Instructions
Get journal entry for a specific date
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Date in YYYY-MM-DD format |
Implementation Reference
- src/journal/manager.ts:373-386 (handler)Core implementation of getEntryByDate: retrieves the journal file for the specified date, reads its content, parses it into a JournalFile structure using parseJournalFile, or returns null if not found or parsing fails.export async function getEntryByDate( date: string ): Promise<JournalFile | null> { const filePath = getDateFilePath(date); const content = await readFileIfExists(filePath); if (!content) return null; try { return await parseJournalFile(filePath, content); } catch { return null; } }
- src/mcp-server.ts:184-227 (registration)Registers the 'get_entry_by_date' MCP tool, defines its input schema (date: string), calls the handler function, and formats the response as text content.this.server.tool( 'get_entry_by_date', 'Get journal entry for a specific date', { date: z.string().describe('Date in YYYY-MM-DD format'), }, async ({ date }) => { const entry = await getEntryByDate(date); if (!entry) { return { content: [ { type: 'text', text: `π No journal entry found for ${date}`, }, ], } satisfies CallToolResult; } let response = `π Journal Entry for ${entry.date}\n\n`; response += `**Tags:** ${entry.tags.join(', ') || 'None'}\n`; response += `**Entries:** ${entry.entries_count}\n`; response += `**Created:** ${new Date( entry.created ).toLocaleString()}\n`; response += `**Updated:** ${new Date( entry.updated ).toLocaleString()}\n\n`; for (const entryItem of entry.entries) { response += `## ${entryItem.timestamp} - ${entryItem.title}\n`; response += `${entryItem.content}\n\n`; } return { content: [ { type: 'text', text: response, }, ], } satisfies CallToolResult; }
- src/mcp-server.ts:188-189 (schema)Input schema for the tool using Zod: requires a 'date' string in YYYY-MM-DD format.date: z.string().describe('Date in YYYY-MM-DD format'), },