delete_prompt
Remove a specific prompt by its name from the Prompts MCP Server, ensuring cleaner prompt management and organization.
Instructions
Delete a prompt by name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the prompt to delete |
Implementation Reference
- src/tools.ts:264-278 (handler)The primary handler for the 'delete_prompt' tool. Validates the 'name' argument and delegates the deletion to fileOps.deletePrompt, returning a success message.private async handleDeletePrompt(args: ToolArguments): Promise<CallToolResult> { if (!args.name) { throw new Error('Name is required for delete_prompt'); } await this.fileOps.deletePrompt(args.name); return { content: [ { type: 'text', text: `Prompt "${args.name}" deleted successfully`, } as TextContent, ], }; }
- src/tools.ts:68-80 (schema)Tool definition including name, description, and input schema specification for 'delete_prompt'.name: 'delete_prompt', description: 'Delete a prompt by name', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt to delete', }, }, required: ['name'], }, },
- src/tools.ts:144-145 (registration)Registration of the handler in the tool call dispatcher switch statement.case 'delete_prompt': return await this.handleDeletePrompt(toolArgs);
- src/fileOperations.ts:85-94 (helper)Helper method in PromptFileOperations that performs the actual file deletion for the prompt.async deletePrompt(name: string): Promise<boolean> { const fileName = this.sanitizeFileName(name) + '.md'; const filePath = path.join(this.promptsDir, fileName); try { await fs.unlink(filePath); return true; } catch (error) { throw new Error(`Prompt "${name}" not found`); } }