get_prompt
Retrieve a specific prompt from Promptopia MCP using its unique ID to access stored prompt content for reuse.
Instructions
Gets a prompt by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the prompt to retrieve |
Implementation Reference
- src/handlers/tools.handler.ts:228-237 (handler)MCP tool handler execution for 'get_prompt': extracts 'id' from input arguments, calls PromptsService.getPrompt(id), and returns the result serialized as JSON text content in MCP format.case 'get_prompt': { const { id } = args const result = await this.promptsService.getPrompt(id) return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] } }
- src/handlers/tools.handler.ts:93-106 (registration)Registration of the 'get_prompt' tool in listTools(), including name, description, and input JSON schema requiring 'id' parameter.{ name: 'get_prompt', description: 'Gets a prompt by its ID', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the prompt to retrieve' } }, required: ['id'] } },
- src/handlers/tools.handler.ts:96-105 (schema)JSON schema definition for 'get_prompt' tool input, specifying object with required 'id' string property.inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the prompt to retrieve' } }, required: ['id'] }
- Supporting method in PromptsService that implements the core retrieval logic: validates ID, reads prompt JSON from filesystem, and throws appropriate errors if not found.async getPrompt(id: string): Promise<Prompt> { if (!id || !id.trim()) { throw new ValidationError('Prompt ID is required') } try { const filePath = path.join(this.promptsDir, `${id}.json`) return await this.fileSystemService.readJSONFile<Prompt>(filePath) } catch (error) { if (error instanceof Error && error.message.includes('not found')) { throw new NotFoundError(`Prompt not found: ${id}`) } throw error } }