get_prompt
Retrieve prompt templates by ID to access pre-built structures with parameters and examples for consistent task execution.
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)Handler function that executes the 'get_prompt' tool logic: fetches prompt by ID from registry, returns details as JSON or error 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)Input schema for the 'get_prompt' tool, defining the required 'id' parameter as a string.{ id: z.string().describe("Prompt template ID"), },
- src/prompts/prompts.ts:207-248 (registration)Direct registration of the 'get_prompt' tool using server.tool(name, description, schema, handler).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 call to registerPromptTools(server), which includes the 'get_prompt' tool registration.registerPromptTools(server);