Skip to main content
Glama
tanker327

Prompts MCP Server

by tanker327

get_prompt

Retrieve prompt templates by name using a structured protocol, enabling efficient access and management of markdown-based prompts with YAML metadata.

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' MCP tool. Validates the 'name' parameter and retrieves the full prompt content from the file system via 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, ], }; }
  • Input schema definition for the 'get_prompt' tool, specifying that a 'name' string is required.
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt to retrieve', }, }, required: ['name'], },
  • src/tools.ts:45-58 (registration)
    Registration of the 'get_prompt' tool within the MCP tool definitions 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'], }, },
  • Helper function in file operations that reads the full content of the prompt file corresponding to the given name.
    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`); } }

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