Skip to main content
Glama
tanker327

Prompts MCP Server

by tanker327

add_prompt

Add new prompt templates to a collection by providing name, filename, and markdown content for easy management and retrieval.

Instructions

Add a new prompt to the collection

Input Schema

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

Implementation Reference

  • The handler function that implements the core logic for the 'add_prompt' tool: validates required arguments (name, filename, content), ensures metadata is present, saves the prompt using fileOps, and returns a 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 expected parameters for the add_prompt tool: name (string), filename (string), content (string), all required.
    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)
    Registration of the 'add_prompt' tool in the getToolDefinitions() method, including name, description, and full input schema.
    {
      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'],
      },
    },
  • Supporting helper function used by add_prompt handler to ensure the prompt content includes YAML frontmatter metadata, adding defaults if absent.
      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;
      }
  • src/tools.ts:138-139 (registration)
    Dispatch/registration case in handleToolCall switch statement that routes 'add_prompt' calls to the handler.
    case 'add_prompt':
      return await this.handleAddPrompt(toolArgs);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a write operation ('Add') but doesn't specify permissions, side effects (e.g., overwriting existing prompts), or error handling. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, clearly stating the tool's action. It's appropriately sized and front-loaded, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity as a mutation operation with no annotations and no output schema, the description is insufficient. It lacks details on behavior, return values, or error cases, leaving significant gaps for an AI agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema fully documents the three parameters (name, filename, content). The description adds no additional meaning beyond the schema, such as format examples or constraints, resulting in the baseline score for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add') and resource ('new prompt to the collection'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'create_structured_prompt' which likely serves a similar purpose, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'create_structured_prompt' or 'list_prompts', nor does it mention prerequisites or context for adding prompts. It's a basic statement with no usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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