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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Prompt template ID |
Implementation Reference
- src/prompts/prompts.ts:213-247 (handler)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 ), }, ], }; } - src/prompts/prompts.ts:210-212 (schema)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"), }, - src/prompts/prompts.ts:207-248 (registration)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);