Skip to main content
Glama
tanker327

Prompts MCP Server

by tanker327

get_prompt

Retrieve prompt templates by name from a markdown-based prompt management system for use in AI applications.

Instructions

Retrieve a prompt by name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the prompt to retrieve

Implementation Reference

  • The primary handler function for the 'get_prompt' tool. Validates the input 'name' parameter and fetches the full prompt content from file operations.
    private async handleGetPrompt(args: ToolArguments): Promise<CallToolResult> {
      if (!args.name) {
        throw new Error('Name is required for get_prompt');
      }
      
      const content = await this.fileOps.readPrompt(args.name);
      return {
        content: [
          {
            type: 'text',
            text: content,
          } as TextContent,
        ],
      };
  • JSON schema defining the input parameters for the get_prompt tool (requires 'name' as string).
    inputSchema: {
      type: 'object',
      properties: {
        name: {
          type: 'string',
          description: 'Name of the prompt to retrieve',
        },
      },
      required: ['name'],
  • src/tools.ts:46-57 (registration)
    Registration of the 'get_prompt' tool definition in the list of available tools returned by getToolDefinitions().
    name: 'get_prompt',
    description: 'Retrieve a prompt by name',
    inputSchema: {
      type: 'object',
      properties: {
        name: {
          type: 'string',
          description: 'Name of the prompt to retrieve',
        },
      },
      required: ['name'],
    },
  • src/tools.ts:140-141 (registration)
    Routing registration for 'get_prompt' in the handleToolCall switch statement.
    case 'get_prompt':
      return await this.handleGetPrompt(toolArgs);
  • Helper method in PromptFileOperations that reads the full content of the prompt markdown file, used by the get_prompt handler.
    async readPrompt(name: string): Promise<string> {
      const fileName = this.sanitizeFileName(name) + '.md';
      const filePath = path.join(this.promptsDir, fileName);
      try {
        return await fs.readFile(filePath, 'utf-8');
      } catch (error) {
        throw new Error(`Prompt "${name}" not found`);
      }
    }

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