growi-mcp-server
Version:
MCP Server for GROWI - a modern Wiki system
42 lines • 1.33 kB
JavaScript
import { z } from 'zod';
export const updatePageSchema = z.object({
path: z.string().describe('Path of the page to update'),
content: z.string().describe('New content for the page in Markdown format'),
});
export async function updatePage(client, params) {
try {
const { path, content } = params;
// Ensure path starts with /
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
const response = await client.updatePage(normalizedPath, content);
if (!response.ok) {
return {
content: [
{
type: 'text',
text: `Error updating page: ${response.error || 'Unknown error'}`,
},
],
};
}
return {
content: [
{
type: 'text',
text: `Page updated successfully at: ${normalizedPath}`,
},
],
};
}
catch (error) {
return {
content: [
{
type: 'text',
text: `Error updating page: ${error instanceof Error ? error.message : String(error)}`,
},
],
};
}
}
//# sourceMappingURL=update-page.js.map