Skip to main content
Glama

render_prompt

Render prompt templates with specific parameters to generate structured content for automation workflows.

Instructions

Render a prompt template with the given parameters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateIdYesThe ID of the template to render
parametersYesParameters for the template

Implementation Reference

  • Handler function that executes the render_prompt tool. Renders the specified prompt template with given parameters using the registry, formats the result (templateId, content, parameters) as pretty JSON in text content block, or returns an error message if rendering fails.
    async (args) => { try { const rendered = registry.prompts.render(args.templateId, args.parameters); return { content: [ { type: "text", text: JSON.stringify( { templateId: rendered.templateId, content: rendered.content, parameters: rendered.parameters, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error rendering prompt: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
  • Input schema (Zod) for the render_prompt tool, requiring templateId (string) and optional parameters (record).
    { templateId: z.string().describe("The ID of the template to render"), parameters: z.record(z.any()).describe("Parameters for the template"), },
  • Registration of the render_prompt MCP tool on the server, specifying name, description, input schema, and handler function.
    server.tool( "render_prompt", "Render a prompt template with the given parameters", { templateId: z.string().describe("The ID of the template to render"), parameters: z.record(z.any()).describe("Parameters for the template"), }, async (args) => { try { const rendered = registry.prompts.render(args.templateId, args.parameters); return { content: [ { type: "text", text: JSON.stringify( { templateId: rendered.templateId, content: rendered.content, parameters: rendered.parameters, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error rendering prompt: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } );

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