Skip to main content
Glama
lumile

Promptopia MCP

by lumile

add_prompt

Add new prompts to Promptopia MCP by specifying name, content with variables, and optional description for system integration.

Instructions

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

Input Schema

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

Implementation Reference

  • Executes the 'add_prompt' tool by destructuring arguments, calling promptsService.addPrompt, and returning the result 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) }] } }
  • Registers the 'add_prompt' MCP tool with its name, description, and input schema in the listTools method.
    { 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'] } },
  • Defines the TypeScript interface AddPromptParams matching the tool's input schema for type safety.
    export interface AddPromptParams { name: string content: string description?: string }
  • Core implementation of adding a prompt: validates params, generates ID and variables, creates SingleContentPrompt, and persists to filesystem.
    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 } }

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