create_journal
Create a journal page in Logseq for today or a specific date, optionally using a template to organize your daily notes.
Instructions
오늘 또는 특정 날짜의 저널 페이지 생성
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | 날짜 (YYYY-MM-DD, 기본값: 오늘) | |
| template | No | 템플릿 내용 (선택) |
Implementation Reference
- src/graph.ts:436-469 (handler)Core implementation of journal page creation: validates date, ensures directory, creates file with template or default content if not exists.async createJournalPage(date?: string, template?: string): Promise<Page> { const targetDate = date || this.getTodayString(); // Validate date format (YYYY-MM-DD only) if (date && !/^\d{4}-\d{2}-\d{2}$/.test(date)) { throw new Error('Invalid date format: use YYYY-MM-DD'); } // 보안 검증: 템플릿 크기 제한 (DoS 방지) if (template) { this.validateContentSize(template); } const fileName = targetDate.replace(/-/g, '_') + '.md'; const filePath = join(this.journalsPath, fileName); this.validatePath(filePath); // Ensure journals directory exists await mkdir(this.journalsPath, { recursive: true }); // 보안 검증: 심링크 공격 방지 await this.checkSymlink(filePath); // Check if already exists try { await stat(filePath); return this.readPage(`journals/${fileName}`); } catch { // Create new journal page const content = template || `- `; await writeFile(filePath, content, 'utf-8'); return this.readPage(`journals/${fileName}`); } }
- src/index.ts:335-341 (handler)MCP call_tool dispatch for 'create_journal': parses input with schema and calls the graph service method.case 'create_journal': { const { date, template } = CreateJournalSchema.parse(args); const page = await graph.createJournalPage(date, template); return { content: [{ type: 'text', text: JSON.stringify(page, null, 2) }], }; }
- src/index.ts:104-107 (schema)Zod validation schema for create_journal tool arguments.const CreateJournalSchema = z.object({ date: z.string().max(10).optional().describe('날짜 (YYYY-MM-DD, 기본값: 오늘)'), template: z.string().max(MAX_CONTENT_LENGTH).optional().describe('템플릿 내용 (선택)'), });
- src/index.ts:226-236 (registration)Registration of 'create_journal' tool in the TOOLS list returned by list_tools.{ name: 'create_journal', description: '오늘 또는 특정 날짜의 저널 페이지 생성', inputSchema: { type: 'object' as const, properties: { date: { type: 'string', description: '날짜 (YYYY-MM-DD, 기본값: 오늘)' }, template: { type: 'string', description: '템플릿 내용 (선택)' }, }, }, },