Skip to main content
Glama

create_documentation_section

Add a new navigation section in markdown documentation by specifying a path and title; includes an index.md file for structured content organization.

Instructions

Create a new navigation section with an index.md file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderNo
pathYes
titleYes

Implementation Reference

  • Core handler implementation: creates directory for sectionPath, generates index.md with frontmatter including title, description, date, status, optional order, and welcome content.
    async createSection( title: string, sectionPath: string, order?: number ): Promise<ToolResponse> { try { // Create the directory for the section const validPath = await this.validatePath(sectionPath); await fs.mkdir(validPath, { recursive: true }); // Create an index.md file for the section const indexPath = path.join(validPath, "index.md"); const validIndexPath = await this.validatePath(indexPath); // Create content with frontmatter let content = "---\n"; content += `title: ${title}\n`; content += `description: ${title} section\n`; content += `date: ${new Date().toISOString()}\n`; content += `status: published\n`; if (order !== undefined) { content += `order: ${order}\n`; } content += "---\n\n"; content += `# ${title}\n\n`; content += `Welcome to the ${title} section.\n`; // Write the index file await fs.writeFile(validIndexPath, content, "utf-8"); return { content: [ { type: "text", text: `Successfully created section: ${title} at ${sectionPath}`, }, ], metadata: { title, path: sectionPath, indexPath: path.join(sectionPath, "index.md"), order, }, }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Error creating section: ${errorMessage}` }, ], isError: true, }; } }
  • Zod schema defining input: title (string), path (string), order (optional number). Extends base ToolInputSchema.
    export const CreateSectionSchema = ToolInputSchema.extend({ title: z.string(), path: z.string(), order: z.number().optional(), });
  • src/index.ts:278-282 (registration)
    MCP tool registration in server tools list: defines name, description, and converts CreateSectionSchema to JSON schema.
    { name: "create_documentation_section", description: "Create a new navigation section with an index.md file.", inputSchema: zodToJsonSchema(CreateSectionSchema) as any, },
  • src/index.ts:455-467 (registration)
    Dispatch handler in CallToolRequest: parses args with CreateSectionSchema, calls documentHandler.createSection(title, path, order). Note: case label 'create_section' does not match registered tool name 'create_documentation_section'.
    case "create_section": { const parsed = CreateSectionSchema.safeParse(args); if (!parsed.success) { throw new Error( `Invalid arguments for create_section: ${parsed.error}` ); } return await documentHandler.createSection( parsed.data.title, parsed.data.path, parsed.data.order ); }

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/alekspetrov/mcp-docs-service'

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