docs_create_page
Create or edit documentation pages using Markdown content for professional documentation systems like Docusaurus, MkDocs, and Sphinx.
Instructions
Create or edit individual documentation pages with Markdown content
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docsPath | Yes | Path to documentation directory | |
| pagePath | Yes | Relative path for the page (e.g., 'guides/getting-started.md') | |
| title | Yes | Page title | |
| content | Yes | Markdown content for the page |
Implementation Reference
- src/tools/createPage.ts:11-42 (handler)The core handler function that executes the tool logic: validates arguments, creates directories recursively, generates Markdown with frontmatter, writes the file, and returns success message.export async function createPage(args: any) { const { docsPath, pagePath, title, content } = args as CreatePageArgs; try { const fullPath = path.resolve(docsPath, pagePath); const dir = path.dirname(fullPath); await fs.mkdir(dir, { recursive: true }); const formattedContent = `--- title: ${title} --- # ${title} ${content} `; await fs.writeFile(fullPath, formattedContent, "utf-8"); return { content: [ { type: "text", text: `✅ Page created successfully at: ${fullPath}`, }, ], }; } catch (error) { throw new Error(`Failed to create page: ${error}`); } }
- src/index.ts:87-108 (schema)JSON schema defining the input parameters for the docs_create_page tool.inputSchema: { type: "object", properties: { docsPath: { type: "string", description: "Path to documentation directory", }, pagePath: { type: "string", description: "Relative path for the page (e.g., 'guides/getting-started.md')", }, title: { type: "string", description: "Page title", }, content: { type: "string", description: "Markdown content for the page", }, }, required: ["docsPath", "pagePath", "title", "content"], },
- src/index.ts:84-110 (registration)Tool registration in the tools array provided to ListToolsRequestSchema.{ name: "docs_create_page", description: "Create or edit individual documentation pages with Markdown content", inputSchema: { type: "object", properties: { docsPath: { type: "string", description: "Path to documentation directory", }, pagePath: { type: "string", description: "Relative path for the page (e.g., 'guides/getting-started.md')", }, title: { type: "string", description: "Page title", }, content: { type: "string", description: "Markdown content for the page", }, }, required: ["docsPath", "pagePath", "title", "content"], }, }, {
- src/index.ts:304-305 (registration)Dispatch case in the CallToolRequestSchema handler that invokes the createPage function.case "docs_create_page": return await createPage(args);