Skip to main content
Glama
GenerateBoilerplatePrompt.ts2.26 kB
import { z } from 'zod'; import generateBoilerplateTemplate from '../instructions/prompts/generate-boilerplate.md?raw'; import { TemplateService } from '../services/TemplateService'; import type { PromptDefinition, PromptMessage } from './types'; /** * Schema for GenerateBoilerplatePrompt constructor options */ export const generateBoilerplatePromptOptionsSchema = z.object({ isMonolith: z.boolean().default(false).describe('Whether the project is a monolith'), promptAsSkill: z.boolean().default(false).describe('Render prompt with skill front matter'), }); export type GenerateBoilerplatePromptOptions = z.input< typeof generateBoilerplatePromptOptionsSchema >; type GenerateBoilerplatePromptParsedOptions = z.output< typeof generateBoilerplatePromptOptionsSchema >; /** * Prompt for generating boilerplates */ export class GenerateBoilerplatePrompt { static readonly PROMPT_NAME = 'generate-boilerplate'; private templateService = new TemplateService(); private options: GenerateBoilerplatePromptParsedOptions; constructor(options: GenerateBoilerplatePromptOptions = {}) { try { this.options = generateBoilerplatePromptOptionsSchema.parse(options); } catch (error) { throw new Error( `Invalid GenerateBoilerplatePrompt options: ${error instanceof Error ? error.message : String(error)}`, ); } } /** * Get the prompt definition for MCP */ getDefinition(): PromptDefinition { return { name: GenerateBoilerplatePrompt.PROMPT_NAME, description: 'Generate a new boilerplate template configuration', arguments: [ { name: 'request', description: 'Describe the boilerplate template you want to create', required: false, }, ], }; } /** * Get the prompt messages */ getMessages(args?: { request?: string }): PromptMessage[] { const request = args?.request || ''; const text = this.templateService.renderString(generateBoilerplateTemplate, { request, isMonolith: this.options.isMonolith, promptAsSkill: this.options.promptAsSkill, }); return [ { role: 'user', content: { type: 'text', text, }, }, ]; } }

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/AgiFlow/aicode-toolkit'

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