delete_prompt
Remove a prompt template by name from the Prompts MCP Server to manage prompt storage 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' MCP tool. Validates the 'name' argument, calls fileOps.deletePrompt, and returns 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/fileOperations.ts:85-94 (helper)Core helper function that performs the actual file deletion by constructing the filepath and using fs.unlink.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`); } }
- src/tools.ts:67-80 (schema)Input schema definition for the 'delete_prompt' tool, specifying the required 'name' string parameter.{ 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 in the handleToolCall switch statement that routes 'delete_prompt' calls to the handler.case 'delete_prompt': return await this.handleDeletePrompt(toolArgs);