Skip to main content
Glama

register_prompt_template

Create reusable prompt templates with variable placeholders and resource references for RPG Maker MZ game development, enabling consistent AI-generated content creation across projects.

Instructions

Register a reusable prompt template with variable placeholders and resource references

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoPrompt description
nameYesPrompt name
project_pathYesProject path
prompt_idYesUnique prompt ID
resource_refsNoReferenced resource IDs
templateYesPrompt template with {{variable}} placeholders
variablesYesList of variable names

Implementation Reference

  • Core handler function that validates the prompt template, loads the project's resource registry, registers the new prompt, saves the registry, and returns success/error response.
    export async function registerPromptTemplate( projectPath: string, prompt: PromptTemplate ): Promise<{ success: boolean; promptId?: string; error?: string }> { try { Validator.requireString(prompt.id, "prompt_id"); Validator.requireString(prompt.name, "prompt_name"); Validator.requireString(prompt.template, "prompt_template"); await Logger.info("Registering prompt template", { projectPath, promptId: prompt.id }); const registry = await loadResourceRegistry(projectPath); registry.prompts.set(prompt.id, prompt); await saveResourceRegistry(registry); return { success: true, promptId: prompt.id }; } catch (error) { await Logger.error("Failed to register prompt", { projectPath, error }); return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
  • MCP tool input JSON schema defining parameters: project_path (required), prompt_id (required), name (required), description (optional), template (required), variables (required array of strings), resource_refs (optional array of resource IDs).
    inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Project path" }, prompt_id: { type: "string", description: "Unique prompt ID" }, name: { type: "string", description: "Prompt name" }, description: { type: "string", description: "Prompt description" }, template: { type: "string", description: "Prompt template with {{variable}} placeholders" }, variables: { type: "array", items: { type: "string" }, description: "List of variable names" }, resource_refs: { type: "array", items: { type: "string" }, description: "Referenced resource IDs" }, }, required: ["project_path", "prompt_id", "name", "template", "variables"], },
  • src/index.ts:1412-1424 (registration)
    MCP server switch case that maps the tool call to the registerPromptTemplate handler function, constructs the PromptTemplate object from args, calls the handler, and formats the response as MCP content.
    case "register_prompt_template": { const result = await registerPromptTemplate(args.project_path as string, { id: args.prompt_id as string, name: args.name as string, description: args.description as string, template: args.template as string, variables: args.variables as string[], resourceRefs: args.resource_refs as string[] }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
  • TypeScript interface defining the structure of a PromptTemplate used by the handler function.
    export interface PromptTemplate { id: string; name: string; description?: string; template: string; variables: string[]; resourceRefs?: string[]; // 参照するリソースID examples?: { input: Record<string, any>; output: string; }[]; }
  • src/index.ts:49-57 (registration)
    Import statement that brings the registerPromptTemplate handler into the MCP server's main index file.
    registerResource, registerPromptTemplate, getResource, listResources, listPromptTemplates, executePrompt, generatePromptFromResources, initializeDefaultPrompts } from "./resource-manager.js";

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/ShunsukeHayashi/rpgmaker-mz-mcp'

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