Skip to main content
Glama

list_journals

Access and display all available journals from the command-line journal management system for efficient organization and retrieval of entries.

Instructions

List all available journals

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that lists available journals by running `jrnl --list`, parsing the output, and returning structured JournalInfo array with current journal detection.
    export async function listJournals( executor: JrnlExecutor, ): Promise<{ journals: JournalInfo[]; currentJournal?: string }> { const command = buildListJournalsCommand(); const result = await executor.execute(command); try { // Parse jrnl --list output // Format can be: // Journals defined in config (/path/to/config) // * default -> /path/to/default.txt // work -> /path/to/work.txt const lines = result.trim().split("\n"); const journals: JournalInfo[] = []; for (const line of lines) { // Skip header lines if (line.includes("Journals defined in config") || line.trim() === "") { continue; } const match = line.match(/^(\s*\*?\s*)(\w+)\s*->\s*(.+)$/); if (match) { const isDefault = line.trim().startsWith("*"); const name = match[2].trim(); const path = match[3].trim(); journals.push({ name, path, isDefault, }); if (isDefault && !currentJournal) { currentJournal = name; } } } return { journals, currentJournal, }; } catch (error) { throw new Error(`Failed to parse journal list: ${error}`); } }
  • Type definition for the output structure of listJournals tool.
    export interface JournalInfo { name: string; path: string; isDefault: boolean; }
  • src/index.ts:120-127 (registration)
    Tool registration in ListToolsRequestHandler, defining name, description, and empty input schema.
    { name: "list_journals", description: "List all available journals", inputSchema: { type: "object", properties: {}, }, },
  • src/index.ts:219-227 (registration)
    Dispatch handler in CallToolRequestSchema that invokes the listJournals function.
    case "list_journals": return { content: [ { type: "text", text: JSON.stringify(await listJournals(executor), null, 2), }, ], };
  • Helper function that builds the command arguments for listing journals (`jrnl --list`).
    export function buildListJournalsCommand(): string[] { return ["--list"]; }

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