update_page
Modify existing Logseq page content and properties directly within your knowledge graph to keep information current and organized.
Instructions
기존 페이지 내용 수정
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | 수정할 페이지 경로 또는 이름 | |
| content | Yes | 새로운 페이지 내용 | |
| properties | No | Logseq 프로퍼티 (선택) |
Implementation Reference
- src/graph.ts:229-238 (handler)Core handler function in GraphService that performs the page update by validating input, resolving path, building content with properties, writing to file, and returning the updated page.async updatePage(pathOrName: string, content: string, properties?: Record<string, unknown>): Promise<Page> { // 보안 검증: 콘텐츠 크기 제한 (DoS 방지) this.validateContentSize(content); const filePath = await this.resolvePath(pathOrName); await this.checkSymlink(filePath); // 심링크 공격 방지 const fullContent = this.buildContent(content, properties); await writeFile(filePath, fullContent, 'utf-8'); return this.readPage(pathOrName); }
- src/index.ts:145-157 (registration)MCP tool registration defining the name, description, and input schema for the update_page tool.{ name: 'update_page', description: '기존 페이지 내용 수정', inputSchema: { type: 'object' as const, properties: { path: { type: 'string', description: '수정할 페이지 경로 또는 이름' }, content: { type: 'string', description: '새로운 페이지 내용' }, properties: { type: 'object', description: 'Logseq 프로퍼티 (선택)' }, }, required: ['path', 'content'], }, },
- src/index.ts:70-74 (schema)Zod validation schema for parsing and validating arguments passed to the update_page tool.const UpdatePageSchema = z.object({ path: z.string().max(MAX_PATH_LENGTH).describe('수정할 페이지 경로 또는 이름'), content: z.string().max(MAX_CONTENT_LENGTH).describe('새로운 페이지 내용'), properties: z.record(z.string().max(10000)).optional().describe('Logseq 프로퍼티 (선택, 문자열 값만)'), });
- src/index.ts:274-280 (handler)Top-level handler in the MCP server that parses arguments using the schema and delegates to GraphService.updatePage.case 'update_page': { const { path, content, properties } = UpdatePageSchema.parse(args); const page = await graph.updatePage(path, content, properties); return { content: [{ type: 'text', text: JSON.stringify(page, null, 2) }], }; }