UNPKG

growi-mcp-server

Version:

MCP Server for GROWI - a modern Wiki system

42 lines 1.34 kB
import { z } from 'zod'; export const createPageSchema = z.object({ path: z.string().describe('Path for the new page (must start with /)'), content: z.string().describe('Content for the new page in Markdown format'), }); export async function createPage(client, params) { try { const { path, content } = params; // Ensure path starts with / const normalizedPath = path.startsWith('/') ? path : `/${path}`; const response = await client.createPage(normalizedPath, content); if (!response.ok) { return { content: [ { type: 'text', text: `Error creating page: ${response.error || 'Unknown error'}`, }, ], }; } return { content: [ { type: 'text', text: `Page created successfully at: ${normalizedPath}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating page: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } //# sourceMappingURL=create-page.js.map