set_journal
Select which journal to use for searching entries, listing tags, and viewing statistics in the command-line journal system.
Instructions
Set the active journal for subsequent operations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| journalName | Yes | Name of the journal to set as active |
Implementation Reference
- src/handlers/journalHandlers.ts:60-69 (handler)The core handler function that implements the logic for the 'set_journal' tool. It sets a module-level 'currentJournal' variable to the provided journalName and returns a success response.export async function setJournal( journalName: string, ): Promise<{ success: boolean; currentJournal: string }> { currentJournal = journalName; return { success: true, currentJournal: journalName, }; }
- src/index.ts:128-141 (registration)Registers the 'set_journal' tool with the MCP server by including it in the list of available tools returned by ListToolsRequestHandler. Includes the tool's input schema for validation.{ name: "set_journal", description: "Set the active journal for subsequent operations", inputSchema: { type: "object", properties: { journalName: { type: "string", description: "Name of the journal to set as active", }, }, required: ["journalName"], }, },
- src/index.ts:131-140 (schema)Defines the input schema for the 'set_journal' tool, specifying that it requires a 'journalName' string parameter.inputSchema: { type: "object", properties: { journalName: { type: "string", description: "Name of the journal to set as active", }, }, required: ["journalName"], },
- src/index.ts:229-243 (handler)The dispatch handler in the CallToolRequestHandler that invokes the setJournal function when 'set_journal' is called, formats the response as MCP content.case "set_journal": return { content: [ { type: "text", text: JSON.stringify( await setJournal( typeof args?.journalName === "string" ? args.journalName : "", ), null, 2, ), }, ], };