render_prompt
Render prompt templates with provided parameters to generate structured inputs for AI tasks within the Open MCP Server's automation workflows.
Instructions
Render a prompt template with the given parameters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| templateId | Yes | The ID of the template to render | |
| parameters | Yes | Parameters for the template |
Implementation Reference
- src/prompts/prompts.ts:252-291 (registration)Registration of the 'render_prompt' MCP tool, including inline handler function that renders the prompt using registry.prompts.render and returns formatted JSON response."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, }; } } );
- src/core/registry.ts:222-228 (handler)Helper function renderPrompt in Registry class that implements PromptExecutor interface by calling this.prompts.render and returning the rendered content.async renderPrompt( promptId: string, parameters: Record<string, unknown> ): Promise<string> { const rendered = this.prompts.render(promptId, parameters); return rendered.content; }
- src/prompts/prompts.ts:255-257 (schema)Zod schema for input parameters of the 'render_prompt' tool: templateId (string) and parameters (record).templateId: z.string().describe("The ID of the template to render"), parameters: z.record(z.any()).describe("Parameters for the template"), },