Skip to main content
Glama

create_page

Create new pages in Logseq with content and optional properties to organize your knowledge graph directly from AI assistants.

Instructions

새 페이지 생성. Logseq 프로퍼티 포함 가능

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes생성할 페이지 이름
contentYes페이지 내용
propertiesNoLogseq 프로퍼티 (선택)

Implementation Reference

  • Core handler function that creates a new Logseq page by writing a .md file to the pages directory after performing security validations (name, content size, path traversal, symlink checks).
    async createPage(name: string, content: string, properties?: Record<string, unknown>): Promise<Page> { // 보안 검증: 화이트리스트 기반 이름 검증 this.validatePageName(name); const filePath = join(this.pagesPath, `${name}.md`); this.validatePath(filePath); // 보안 검증: 콘텐츠 크기 제한 (DoS 방지) this.validateContentSize(content); // Ensure pages directory exists await mkdir(this.pagesPath, { recursive: true }); // 보안 검증: 심링크 공격 방지 await this.checkSymlink(filePath); const fullContent = this.buildContent(content, properties); // 보안: TOCTOU 방지 - 'wx' 플래그로 원자적 생성 (파일 존재 시 실패) try { await writeFile(filePath, fullContent, { encoding: 'utf-8', flag: 'wx' }); } catch (e: any) { if (e.code === 'EEXIST') { throw new Error(`Page already exists: ${name}`); } throw e; } return this.readPage(name); }
  • MCP CallToolRequest handler switch case that validates input arguments using Zod schema and delegates execution to GraphService.createPage, returning the result as JSON.
    case 'create_page': { const { name: pageName, content, properties } = CreatePageSchema.parse(args); const page = await graph.createPage(pageName, content, properties); return { content: [{ type: 'text', text: JSON.stringify(page, null, 2) }], }; }
  • Zod schema used for runtime validation of create_page tool arguments within the tool handler.
    const CreatePageSchema = z.object({ name: z.string().max(MAX_NAME_LENGTH).describe('생성할 페이지 이름'), content: z.string().max(MAX_CONTENT_LENGTH).describe('페이지 내용'), properties: z.record(z.string().max(10000)).optional().describe('Logseq 프로퍼티 (선택, 문자열 값만)'), });
  • src/index.ts:132-144 (registration)
    Tool registration in the TOOLS array provided to ListToolsRequest, including JSON Schema for input validation and tool description.
    { name: 'create_page', description: '새 페이지 생성. Logseq 프로퍼티 포함 가능', inputSchema: { type: 'object' as const, properties: { name: { type: 'string', description: '생성할 페이지 이름' }, content: { type: 'string', description: '페이지 내용' }, properties: { type: 'object', description: 'Logseq 프로퍼티 (선택)' }, }, required: ['name', 'content'], }, },

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/dearcloud09/logseq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server