Skip to main content
Glama
tanker327

Prompts MCP Server

by tanker327

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
NameRequiredDescriptionDefault
nameYesName of the prompt to delete

Implementation Reference

  • 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,
        ],
      };
    }
  • 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`);
      }
    }
  • 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);

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/tanker327/prompts-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server