Skip to main content
Glama

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
NameRequiredDescriptionDefault
contentYesTemplate content with {title} placeholder
metadataNoDefault metadata for the template
templateNameYesName of the template

Implementation Reference

  • 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"]
      }
    }
  • 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"]
    }
  • 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>;
    }

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/ryanjoachim/mcp-rtfm'

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