Skip to main content
Glama
coji

Journal MCP Server

by coji

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
NameRequiredDescriptionDefault
dateYesDate in YYYY-MM-DD format

Implementation Reference

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

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other 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/coji/journal-mcp'

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