Skip to main content
Glama

search_entries

Search and filter journal entries by date, tags, keywords, or starred status using specific parameters to retrieve relevant results efficiently.

Instructions

Search and filter journal entries

Input Schema

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

Implementation Reference

  • The main handler function implementing the search_entries tool logic. It builds a search command using provided filters, executes it via JrnlExecutor, parses the JSON output, transforms entries, and returns entries and tags.
    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 handler.
    export interface SearchEntriesParams { from?: string; to?: string; tags?: string[]; contains?: string; limit?: number; starred?: boolean; journal?: string; }
  • TypeScript interface defining the structure of a journal entry returned by the handler.
    export interface JournalEntry { date: string; time: string; title: string; body: string; tags: string[]; starred: boolean; }
  • src/index.ts:36-64 (registration)
    MCP tool registration defining the 'search_entries' tool's metadata and input schema in the ListTools response.
    { 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)
    Dispatch handler in the CallToolRequestHandler switch statement that invokes the searchEntries function.
    case "search_entries": return { content: [ { type: "text", text: JSON.stringify( await searchEntries({ ...args, journal } as any, executor), null, 2, ), }, ], };

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

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