Skip to main content
Glama
tanker327

Prompts MCP Server

by tanker327

add_prompt

Add new prompts to the Prompts MCP Server by specifying a name, filename, and markdown content. Streamline prompt management and organization within the server's template collection.

Instructions

Add a new prompt to the collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesContent of the prompt in markdown format
filenameYesEnglish filename for the prompt file (without .md extension)
nameYesName of the prompt

Implementation Reference

  • Main execution logic for add_prompt: validates required args (name, filename, content), adds metadata if missing, saves file via fileOps, returns success message.
    private async handleAddPrompt(args: ToolArguments): Promise<CallToolResult> { if (!args.name || !args.filename || !args.content) { throw new Error('Name, filename, and content are required for add_prompt'); } // Validate and enhance content with metadata if needed const processedContent = this.ensureMetadata(args.content, args.name); const fileName = await this.fileOps.savePromptWithFilename(args.filename, processedContent); return { content: [ { type: 'text', text: `Prompt "${args.name}" saved as ${fileName}`, } as TextContent, ], }; }
  • Input schema defining the required parameters for add_prompt: name, filename, and content.
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt', }, filename: { type: 'string', description: 'English filename for the prompt file (without .md extension)', }, content: { type: 'string', description: 'Content of the prompt in markdown format', }, }, required: ['name', 'filename', 'content'], },
  • src/tools.ts:23-44 (registration)
    Tool registration in getToolDefinitions(): defines name, description, and inputSchema for add_prompt.
    { name: 'add_prompt', description: 'Add a new prompt to the collection', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt', }, filename: { type: 'string', description: 'English filename for the prompt file (without .md extension)', }, content: { type: 'string', description: 'Content of the prompt in markdown format', }, }, required: ['name', 'filename', 'content'], }, },
  • src/tools.ts:138-139 (registration)
    Dispatch case in handleToolCall that routes add_prompt calls to the handler.
    case 'add_prompt': return await this.handleAddPrompt(toolArgs);
  • Helper to add default YAML frontmatter metadata to prompt content if not already present.
    private ensureMetadata(content: string, promptName: string): string { // Check if content already has frontmatter if (content.trim().startsWith('---')) { return content; // Already has frontmatter, keep as-is } // Add default frontmatter if missing const defaultMetadata = `--- title: "${promptName.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}" description: "A prompt for ${promptName.replace(/-/g, ' ')}" category: "general" tags: ["general"] difficulty: "beginner" author: "User" version: "1.0" created: "${new Date().toISOString().split('T')[0]}" --- `; return defaultMetadata + content; }

Other Tools

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

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