Skip to main content
Glama

get_prompt

Retrieve prompt templates by ID to access pre-built structures with parameters and examples for consistent task execution.

Instructions

Get a prompt template by ID with its parameters and examples

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesPrompt template ID

Implementation Reference

  • Handler function that executes the 'get_prompt' tool logic: fetches prompt by ID from registry, returns details as JSON or error if not found.
    async (args) => { const prompt = registry.prompts.get(args.id); if (!prompt) { return { content: [ { type: "text", text: `Prompt not found: ${args.id}`, }, ], isError: true, }; } return { content: [ { type: "text", text: JSON.stringify( { id: prompt.id, name: prompt.name, description: prompt.description, category: prompt.category, parameters: prompt.parameters, examples: prompt.examples, tags: prompt.tags, }, null, 2 ), }, ], }; }
  • Input schema for the 'get_prompt' tool, defining the required 'id' parameter as a string.
    { id: z.string().describe("Prompt template ID"), },
  • Direct registration of the 'get_prompt' tool using server.tool(name, description, schema, handler).
    server.tool( "get_prompt", "Get a prompt template by ID with its parameters and examples", { id: z.string().describe("Prompt template ID"), }, async (args) => { const prompt = registry.prompts.get(args.id); if (!prompt) { return { content: [ { type: "text", text: `Prompt not found: ${args.id}`, }, ], isError: true, }; } return { content: [ { type: "text", text: JSON.stringify( { id: prompt.id, name: prompt.name, description: prompt.description, category: prompt.category, parameters: prompt.parameters, examples: prompt.examples, tags: prompt.tags, }, null, 2 ), }, ], }; } );
  • src/index.ts:71-71 (registration)
    Top-level registration call to registerPromptTools(server), which includes the 'get_prompt' tool registration.
    registerPromptTools(server);

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/ishuru/open-mcp'

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