append_to_page
Add content to the end of existing Logseq pages to extend notes and maintain knowledge graphs without manual editing.
Instructions
기존 페이지 끝에 내용 추가
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | 페이지 경로 또는 이름 | |
| content | Yes | 추가할 내용 |
Implementation Reference
- src/graph.ts:252-266 (handler)Core handler that performs the append operation: validates input content size, resolves the target file path safely, reads existing content, appends the new content with a newline separator, re-validates the combined content size, writes the updated content back to the file, and returns the full updated page metadata.async appendToPage(pathOrName: string, content: string): Promise<Page> { // 보안 검증: 추가할 콘텐츠 크기 제한 (DoS 방지) this.validateContentSize(content); const filePath = await this.resolvePath(pathOrName); await this.checkSymlink(filePath); // 심링크 공격 방지 const existing = await readFile(filePath, 'utf-8'); const newContent = existing.trimEnd() + '\n' + content; // 결합된 콘텐츠도 크기 검증 this.validateContentSize(newContent); await writeFile(filePath, newContent, 'utf-8'); return this.readPage(pathOrName); }
- src/index.ts:290-296 (handler)MCP tool dispatch handler: parses tool arguments using Zod schema, calls the GraphService appendToPage method, and returns the result as JSON-formatted text content.case 'append_to_page': { const { path, content } = AppendToPageSchema.parse(args); const page = await graph.appendToPage(path, content); return { content: [{ type: 'text', text: JSON.stringify(page, null, 2) }], }; }
- src/index.ts:169-180 (registration)Tool registration entry in the TOOLS array, defining the tool name, description, and JSON input schema for MCP list_tools.{ name: 'append_to_page', description: '기존 페이지 끝에 내용 추가', inputSchema: { type: 'object' as const, properties: { path: { type: 'string', description: '페이지 경로 또는 이름' }, content: { type: 'string', description: '추가할 내용' }, }, required: ['path', 'content'], }, },
- src/index.ts:80-83 (schema)Zod runtime validation schema for append_to_page tool inputs, enforcing path and content length limits.const AppendToPageSchema = z.object({ path: z.string().max(MAX_PATH_LENGTH).describe('페이지 경로 또는 이름'), content: z.string().max(MAX_CONTENT_LENGTH).describe('추가할 내용'), });