Skip to main content
Glama
lumile

Promptopia MCP

by lumile

add_prompt

Add new prompts with structured content and variables to Promptopia MCP for streamlined system integration.

Instructions

Adds a new prompt to the system (single content format)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesContent of the prompt with variables in {{variable}} format
descriptionNoDescription of the prompt
nameYesName of the prompt

Implementation Reference

  • Core handler function that validates input parameters, generates a unique ID, extracts template variables, constructs the prompt object, and persists it to a JSON file in the prompts directory.
    async addPrompt(params: AddPromptParams): Promise<Prompt> { if (!params.name || !params.name.trim()) { throw new ValidationError('Prompt name is required') } if (!params.content || !params.content.trim()) { throw new ValidationError('Prompt content is required') } const id = `prompt-${uuidv4().slice(0, 8)}` const variables = this.extractVariables(params.content) const now = new Date().toISOString() const prompt: SingleContentPrompt = { id, name: params.name.trim(), content: params.content, description: params.description?.trim() || '', variables, createdAt: now, updatedAt: now } try { await this.fileSystemService.writeJSONFile( path.join(this.promptsDir, `${id}.json`), prompt ) return prompt } catch (error) { console.error('Failed to save prompt:', error) throw error } }
  • Tool registration in listTools() method, defining the name, description, and input schema for the 'add_prompt' MCP tool.
    { name: 'add_prompt', description: 'Adds a new prompt to the system (single content format)', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt' }, content: { type: 'string', description: 'Content of the prompt with variables in {{variable}} format' }, description: { type: 'string', description: 'Description of the prompt' } }, required: ['name', 'content'] } },
  • MCP tool dispatcher in callTool() that extracts arguments, delegates to PromptsService.addPrompt, and formats the response as MCP content.
    case 'add_prompt': { const { name, content, description } = args const result = await this.promptsService.addPrompt({ name, content, description }) return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] } }
  • TypeScript interface defining the input parameters for the addPrompt function, matching the tool's inputSchema.
    export interface AddPromptParams { name: string content: string description?: string }

Other Tools

Related Tools

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/lumile/promptopia-mcp'

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