Skip to main content
Glama

get_prompt

Retrieve complete prompt content and metadata by exact name after using search_prompts to identify the correct prompt.

Instructions

📖 Get Full Prompt: Retrieve a specific prompt by its exact name. ⚠️ IMPORTANT: Use search_prompts first to find the correct prompt name, then use this tool. Returns the complete prompt content with metadata and template variables.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesExact prompt name from search results. Must match exactly (e.g., "api_documentation_generator", "REST API Endpoint Generator"). Copy the name field from search_prompts results.

Implementation Reference

  • Registration of the 'get_prompt' MCP tool including name, description, and inputSchema.
    { name: 'get_prompt', description: '📖 Get Full Prompt: Retrieve a specific prompt by its exact name. ⚠️ IMPORTANT: Use search_prompts first to find the correct prompt name, then use this tool. Returns the complete prompt content with metadata and template variables.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Exact prompt name from search results. Must match exactly (e.g., "api_documentation_generator", "REST API Endpoint Generator"). Copy the name field from search_prompts results.', }, }, required: ['name'], examples: [ { name: "software_project_build_plan_generator", description: "Get the build plan generator prompt" }, { name: "youtube_metadata_generator", description: "Get the YouTube metadata prompt" } ], }, },
  • The handler function that implements the logic for the 'get_prompt' tool: retrieves the prompt from cache, handles errors with suggestions, and formats the response.
    private handleGetPrompt(args: EnhancedToolArguments): CallToolResult { if (!args.name) { throw new Error('Prompt name is required. 💡 TIP: Use search_prompts first to find the exact prompt name, then use that name here.'); } const prompt = this.cache.getPrompt(args.name); if (!prompt) { // Suggest similar prompts const allPrompts = this.cache.getAllPrompts(); const searchTerm = args.name.toLowerCase(); const similarPrompts = allPrompts .filter(p => p.name.toLowerCase().includes(searchTerm) || p.metadata.title?.toLowerCase().includes(searchTerm)) .slice(0, 3) .map(p => `- ${p.name} (${p.metadata.title})`) .join('\n'); const suggestion = similarPrompts ? `\n\n💡 Did you mean one of these?\n${similarPrompts}\n\n🔍 Use search_prompts to find the exact name.` : '\n\n🔍 Use search_prompts to find available prompt names.'; throw new Error(`Prompt "${args.name}" not found.${suggestion}`); } const text = `# ${prompt.metadata.title || prompt.name}\n\n` + `**Name:** ${prompt.name}\n` + `**Category:** ${prompt.metadata.category || 'uncategorized'}\n` + `**Tags:** ${prompt.metadata.tags?.join(', ') || 'none'}\n` + `**Description:** ${prompt.metadata.description || 'No description'}\n` + `**Author:** ${prompt.metadata.author || 'Unknown'}\n` + `**Difficulty:** ${prompt.metadata.difficulty || 'intermediate'}\n\n` + `## Content:\n\n${prompt.content}`; return { content: [ { type: 'text', text, } as TextContent, ], }; }
  • Helper method in PromptCache that retrieves a specific prompt by name from the internal cache map.
    getPrompt(name: string): PromptInfo | undefined { return this.cache.get(name); }
  • Tool dispatch in handleToolCall switch statement that routes 'get_prompt' calls to the handler.
    case 'get_prompt': return this.handleGetPrompt(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/jezweb/smart-prompts-mcp'

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