Skip to main content
Glama
lumile

Promptopia MCP

by lumile

update_prompt

Modify existing prompts in Promptopia MCP by updating names, descriptions, or message content, including converting single content to multi-message formats.

Instructions

Updates an existing prompt (supports both single content and multi-message formats)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the prompt to update
nameNoNew name for the prompt
descriptionNoNew description for the prompt
messagesNoNew messages (converts single content to multi-message format)

Implementation Reference

  • Registration of the 'update_prompt' tool including name, description, and input schema definition.
    {
      name: 'update_prompt',
      description: 'Updates an existing prompt (supports both single content and multi-message formats)',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'ID of the prompt to update'
          },
          name: {
            type: 'string',
            description: 'New name for the prompt'
          },
          description: {
            type: 'string',
            description: 'New description for the prompt'
          },
          messages: {
            type: 'array',
            description: 'New messages (converts single content to multi-message format)',
            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: ['id']
      }
    },
  • MCP tool handler implementation for 'update_prompt': extracts parameters, calls PromptsService.updatePrompt, and formats response.
    case 'update_prompt': {
      const { id, name, description, messages } = args
      const result = await this.promptsService.updatePrompt({ id, name, description, messages })
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(result, null, 2)
        }]
      }
    }
  • Core logic for updating a prompt: validates input, loads existing prompt, applies updates or converts format, persists to filesystem.
    async updatePrompt(params: UpdatePromptParams): Promise<UpdatePromptResult> {
      if (!params.id || !params.id.trim()) {
        throw new ValidationError('Prompt ID is required')
      }
    
      // At least one field to update must be provided
      if (!params.name && !params.description && !params.messages) {
        throw new ValidationError('At least one field to update must be provided')
      }
    
      try {
        // First get the existing prompt
        const existingPrompt = await this.getPrompt(params.id)
        
        let updatedPrompt: Prompt
    
        if (isMultiMessagePrompt(existingPrompt)) {
          // Update existing multi-message prompt
          updatedPrompt = {
            ...existingPrompt,
            ...(params.name && { name: params.name.trim() }),
            ...(params.description !== undefined && { description: params.description.trim() || '' }),
            ...(params.messages && {
              messages: params.messages,
              variables: this.extractVariablesFromMessages(params.messages)
            }),
            updatedAt: new Date().toISOString()
          }
        } else {
          // Convert single content prompt to multi-message if messages are provided
          if (params.messages) {
            updatedPrompt = {
              id: existingPrompt.id,
              name: params.name?.trim() || existingPrompt.name,
              description: params.description !== undefined ? (params.description.trim() || '') : existingPrompt.description,
              variables: this.extractVariablesFromMessages(params.messages),
              createdAt: existingPrompt.createdAt,
              updatedAt: new Date().toISOString(),
              version: '2.0',
              messages: params.messages
            }
          } else {
            // Keep as single content format
            updatedPrompt = {
              ...existingPrompt,
              ...(params.name && { name: params.name.trim() }),
              ...(params.description !== undefined && { description: params.description.trim() || '' }),
              updatedAt: new Date().toISOString()
            }
          }
        }
        
        // Save the updated prompt
        const filePath = path.join(this.promptsDir, `${params.id}.json`)
        await this.fileSystemService.writeJSONFile(filePath, updatedPrompt)
        
        return {
          success: true,
          message: `Prompt ${params.id} updated successfully`,
          prompt: updatedPrompt
        }
      } catch (error) {
        if (error instanceof Error && error.message.includes('not found')) {
          throw new NotFoundError(`Prompt not found: ${params.id}`)
        }
        console.error('Failed to update prompt:', error)
        throw error
      }
    }
  • TypeScript interface defining input parameters for updatePrompt.
    export interface UpdatePromptParams {
      id: string
      name?: string
      description?: string
      messages?: PromptMessage[]
    }
  • TypeScript interface defining return type for updatePrompt.
    export interface UpdatePromptResult {
      success: boolean
      message: string
      prompt: Prompt
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool updates prompts, implying mutation, but doesn't address critical aspects like required permissions, whether changes are reversible, error handling, or rate limits. The mention of format conversion adds some context, but overall, it lacks sufficient detail for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and key feature (format support). There's no wasted verbiage, though it could be slightly more structured (e.g., separating purpose from usage notes). It earns its place by conveying essential information concisely.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (mutation with 4 parameters, nested objects in 'messages', no output schema, and no annotations), the description is inadequate. It doesn't explain return values, error cases, or behavioral nuances like how partial updates are handled. For a tool that modifies data without structured safety hints, more completeness is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters (id, name, description, messages). The description adds minimal value beyond this, only implying that 'messages' can handle format conversion. No additional syntax, constraints, or examples are provided, making the baseline score appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Updates') and resource ('an existing prompt'), specifying it handles both single content and multi-message formats. It distinguishes from siblings like 'add_prompt' (creation) and 'delete_prompt' (removal), though not explicitly named. However, it doesn't fully differentiate from 'add_multi_message_prompt' which might also handle multi-message formats, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'add_prompt' for creation or 'apply_prompt' for usage. It mentions format support but doesn't specify prerequisites (e.g., needing an existing prompt ID) or exclusions (e.g., not for new prompts). This leaves the agent with minimal context for selection among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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