Skip to main content
Glama
template-creator.ts1.46 kB
import { z } from 'zod'; import { saveTemplate, Template } from '../storage/templates.js'; import { logger } from '../config/logging.js'; /** * Input schema for the Create Template tool */ export const createTemplateSchema = z.object({ name: z.string().min(1, "Template name is required"), description: z.string().optional(), content: z.string().min(1, "Template content is required"), tags: z.array(z.string()).optional(), }); /** * Type for the input parameters */ export type CreateTemplateParams = z.infer<typeof createTemplateSchema>; /** * Create a new PRD template in storage * * @param name - The name of the template * @param description - Optional description of the template * @param content - Markdown content of the template * @param tags - Optional array of tags * @returns The created Template object */ export async function createTemplate( name: string, description: string | undefined, content: string, tags?: string[] ): Promise<Template> { try { logger.info(`Creating new template: ${name}`); const template = await saveTemplate({ name, description, content, tags }); logger.info(`Template created successfully: ${template.id}`); return template; } catch (error) { logger.error(`Error creating template: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`Failed to create template: ${error instanceof Error ? error.message : 'Unknown error'}`); } }

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/Saml1211/PRD-MCP-Server'

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