delete_prompt
Remove stored prompts by ID to manage your prompt library in Promptopia MCP.
Instructions
Deletes a prompt by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the prompt to delete |
Implementation Reference
- src/handlers/tools.handler.ts:249-258 (handler)MCP tool handler execution logic for 'delete_prompt': extracts 'id' from args, calls promptsService.deletePrompt(id), and formats the result as MCP response content.case 'delete_prompt': { const { id } = args const result = await this.promptsService.deletePrompt(id) return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] } }
- src/handlers/tools.handler.ts:115-128 (registration)Tool registration in listTools(): defines name, description, and inputSchema for 'delete_prompt'.{ name: 'delete_prompt', description: 'Deletes a prompt by its ID', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the prompt to delete' } }, required: ['id'] } },
- Core deletePrompt method in PromptsService: validates id, checks existence, deletes the JSON file, returns success result.async deletePrompt(id: string): Promise<DeletePromptResult> { if (!id || !id.trim()) { throw new ValidationError('Prompt ID is required') } try { // First check if the prompt exists await this.getPrompt(id) // If it exists, delete it const filePath = path.join(this.promptsDir, `${id}.json`) await this.fileSystemService.deleteFile(filePath) return { success: true, message: `Prompt ${id} deleted successfully` } } catch (error) { if (error instanceof Error && error.message.includes('not found')) { throw new NotFoundError(`Prompt not found: ${id}`) } console.error('Failed to delete prompt:', error) throw error } }
- src/types/index.ts:79-82 (schema)Type definition for the return value of deletePrompt.export interface DeletePromptResult { success: boolean message: string }