Skip to main content
Glama

search_entries

Search and filter journal entries by date, tags, text content, or starred status to find specific records in your journal.

Instructions

Search and filter journal entries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromNoStart date (e.g., "yesterday", "2024-01-01")
toNoEnd date
tagsNoTags to filter by
containsNoText to search for
limitNoMaximum number of entries
starredNoOnly show starred entries
journalNoJournal name (uses current/default if not specified)

Implementation Reference

  • Core handler function that builds a search command using filters from params, executes it via JrnlExecutor, parses the JSON output, transforms entries to JournalEntry format, and returns entries and tag counts.
    export async function searchEntries( params: SearchEntriesParams, executor: JrnlExecutor, ): Promise<{ entries: JournalEntry[]; tags: Record<string, number> }> { const filters: SearchFilters = { from: params.from, to: params.to, tags: params.tags, contains: params.contains, limit: params.limit, starred: params.starred, }; const command = buildSearchCommand(filters, params.journal); const result = await executor.execute(command); try { const data = JSON.parse(result); // jrnl exports in a specific format, need to transform it const entries: JournalEntry[] = data.entries.map((entry: any) => ({ date: entry.date, time: entry.time || "", title: entry.title || "", body: entry.body || "", tags: entry.tags || [], starred: entry.starred || false, })); return { entries, tags: data.tags || {}, }; } catch (error) { throw new Error(`Failed to parse jrnl output: ${error}`); } }
  • TypeScript interface defining the input parameters for the searchEntries tool.
    export interface SearchEntriesParams { from?: string; to?: string; tags?: string[]; contains?: string; limit?: number; starred?: boolean; journal?: string; }
  • TypeScript interface defining the structure of journal entries returned by the tool.
    export interface JournalEntry { date: string; time: string; title: string; body: string; tags: string[]; starred: boolean; }
  • src/index.ts:37-64 (registration)
    MCP tool registration including name, description, and input schema definition in the ListToolsRequestHandler.
    name: "search_entries", description: "Search and filter journal entries", inputSchema: { type: "object", properties: { from: { type: "string", description: 'Start date (e.g., "yesterday", "2024-01-01")', }, to: { type: "string", description: "End date" }, tags: { type: "array", items: { type: "string" }, description: "Tags to filter by", }, contains: { type: "string", description: "Text to search for" }, limit: { type: "number", description: "Maximum number of entries" }, starred: { type: "boolean", description: "Only show starred entries", }, journal: { type: "string", description: "Journal name (uses current/default if not specified)", }, }, }, },
  • src/index.ts:154-166 (registration)
    Dispatcher case in CallToolRequestHandler that invokes the searchEntries handler with parameters and current journal.
    case "search_entries": return { content: [ { type: "text", text: JSON.stringify( await searchEntries({ ...args, journal } as any, executor), null, 2, ), }, ], };

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/yostos/jrnl-mcp'

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