Skip to main content
Glama

get_prompt

Retrieve prompt templates by ID to access parameters and examples for automation tasks.

Instructions

Get a prompt template by ID with its parameters and examples

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesPrompt template ID

Implementation Reference

  • The execution handler for the MCP 'get_prompt' tool. Retrieves the prompt by ID from the internal registry and returns structured JSON with prompt details (name, description, category, parameters, examples, tags) or an error response 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 ), }, ], }; }
  • Zod schema defining the input for 'get_prompt': a required string 'id' parameter representing the prompt template ID.
    { id: z.string().describe("Prompt template ID"), },
  • Direct MCP tool registration call using server.tool(), specifying name, description, input schema, and handler function for 'get_prompt'.
    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 of the prompts module, which includes the 'get_prompt' tool, called during MCP server setup.
    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