get_prompt
Retrieve prompt templates by name from a markdown-based prompt management system for use in AI applications.
Instructions
Retrieve a prompt by name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the prompt to retrieve |
Implementation Reference
- src/tools.ts:216-229 (handler)The primary handler function for the 'get_prompt' tool. Validates the input 'name' parameter and fetches the full prompt content from file operations.private async handleGetPrompt(args: ToolArguments): Promise<CallToolResult> { if (!args.name) { throw new Error('Name is required for get_prompt'); } const content = await this.fileOps.readPrompt(args.name); return { content: [ { type: 'text', text: content, } as TextContent, ], };
- src/tools.ts:48-56 (schema)JSON schema defining the input parameters for the get_prompt tool (requires 'name' as string).inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt to retrieve', }, }, required: ['name'],
- src/tools.ts:46-57 (registration)Registration of the 'get_prompt' tool definition in the list of available tools returned by getToolDefinitions().name: 'get_prompt', description: 'Retrieve a prompt by name', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the prompt to retrieve', }, }, required: ['name'], },
- src/tools.ts:140-141 (registration)Routing registration for 'get_prompt' in the handleToolCall switch statement.case 'get_prompt': return await this.handleGetPrompt(toolArgs);
- src/fileOperations.ts:50-58 (helper)Helper method in PromptFileOperations that reads the full content of the prompt markdown file, used by the get_prompt handler.async readPrompt(name: string): Promise<string> { const fileName = this.sanitizeFileName(name) + '.md'; const filePath = path.join(this.promptsDir, fileName); try { return await fs.readFile(filePath, 'utf-8'); } catch (error) { throw new Error(`Prompt "${name}" not found`); } }