Skip to main content
Glama
lumile

Promptopia MCP

by lumile

add_multi_message_prompt

Create role-based multi-message prompts with structured inputs like text or image content for interactive dialogues in Promptopia MCP.

Instructions

Adds a new multi-message prompt with role-based messages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoDescription of the prompt
messagesYesArray of messages with roles
nameYesName of the prompt

Implementation Reference

  • Core implementation of the addMultiMessagePrompt tool: validates parameters, generates unique ID, extracts variables from messages, constructs MultiMessagePrompt object, persists to JSON file via FileSystemService, and returns the created prompt.
    async addMultiMessagePrompt(params: AddMultiMessagePromptParams): Promise<MultiMessagePrompt> { if (!params.name || !params.name.trim()) { throw new ValidationError('Prompt name is required') } if (!params.messages || !Array.isArray(params.messages) || params.messages.length === 0) { throw new ValidationError('At least one message is required') } if (!PromptValidationUtils.validateMessages(params.messages)) { throw new ValidationError('Invalid message structure') } const id = `prompt-${uuidv4().slice(0, 8)}` const variables = this.extractVariablesFromMessages(params.messages) const prompt: MultiMessagePrompt = { id, name: params.name.trim(), description: params.description?.trim() || '', variables, createdAt: new Date().toISOString(), version: '2.0', messages: params.messages } try { await this.fileSystemService.writeJSONFile( path.join(this.promptsDir, `${id}.json`), prompt ) return prompt } catch (error) { console.error('Failed to save multi-message prompt:', error) throw error } }
  • MCP tool dispatch handler in callTool method: extracts arguments, calls PromptsService.addMultiMessagePrompt, formats result as MCP content response (JSON stringified).
    case 'add_multi_message_prompt': { const { name, description, messages } = args const result = await this.promptsService.addMultiMessagePrompt({ name, description, messages }) return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] } }
  • Tool registration in listTools(): defines name, description, and detailed inputSchema matching AddMultiMessagePromptParams.
    { name: 'add_multi_message_prompt', description: 'Adds a new multi-message prompt with role-based messages', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt' }, description: { type: 'string', description: 'Description of the prompt' }, messages: { type: 'array', description: 'Array of messages with roles', items: { type: 'object', properties: { role: { type: 'string', enum: ['user', 'assistant'], description: 'Role of the message sender' }, content: { type: 'object', properties: { type: { type: 'string', enum: ['text', 'image'], description: 'Type of content' }, text: { type: 'string', description: 'Text content (required for text type)' }, image: { type: 'string', description: 'Image data (required for image type)' } }, required: ['type'] } }, required: ['role', 'content'] } } }, required: ['name', 'messages'] } }
  • TypeScript interface defining input parameters for addMultiMessagePrompt, used by PromptsService and matching the tool's inputSchema.
    export interface AddMultiMessagePromptParams { name: string description?: string messages: PromptMessage[] }

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