customize_template
Create or update custom documentation templates with placeholders and metadata to streamline content creation and improve knowledge base organization.
Instructions
Create or update a custom documentation template
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Template content with {title} placeholder | |
| metadata | No | Default metadata for the template | |
| templateName | Yes | Name of the template |
Implementation Reference
- src/index.ts:1154-1190 (handler)Handler function for the 'customize_template' tool. It extracts arguments, stores the custom template in state.templateOverrides, and returns a success response with available templates.case "customize_template": { const { templateName, content, metadata } = request.params.arguments as { templateName: string; content: string; metadata?: Partial<DocMetadata>; }; try { state.templateOverrides[templateName] = { name: templateName, content, metadata: metadata || {} }; return { content: [ { type: "text", text: JSON.stringify({ message: "Template customized successfully", templateName, availableTemplates: [ ...Object.keys(TEMPLATES), ...Object.keys(state.templateOverrides) ] }, null, 2) } ] }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); throw new McpError( ErrorCode.InternalError, `Error customizing template: ${errorMessage}` ); } }
- src/index.ts:575-600 (registration)Tool registration in ListToolsRequestSchema handler, defining name, description, and input schema for 'customize_template'.{ name: "customize_template", description: "Create or update a custom documentation template", inputSchema: { type: "object", properties: { templateName: { type: "string", description: "Name of the template" }, content: { type: "string", description: "Template content with {title} placeholder" }, metadata: { type: "object", description: "Default metadata for the template", properties: { category: { type: "string" }, tags: { type: "array", items: { type: "string" } } } } }, required: ["templateName", "content"] } }
- src/index.ts:578-599 (schema)Input schema definition for the 'customize_template' tool, specifying parameters like templateName, content, and optional metadata.inputSchema: { type: "object", properties: { templateName: { type: "string", description: "Name of the template" }, content: { type: "string", description: "Template content with {title} placeholder" }, metadata: { type: "object", description: "Default metadata for the template", properties: { category: { type: "string" }, tags: { type: "array", items: { type: "string" } } } } }, required: ["templateName", "content"] }
- src/index.ts:72-76 (helper)Interface defining the structure of a DocTemplate used by the customize_template tool for storing custom templates.interface DocTemplate { name: string; content: string; metadata: Partial<DocMetadata>; }