get_prompt
Retrieve a specific prompt by its unique ID using the Promptopia MCP server for quick and precise access to stored prompts.
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)Tool execution handler in callTool method: extracts 'id' from arguments, retrieves prompt via service, returns JSON-formatted result as MCP content.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)Tool registration in listTools(): defines name, description, and input schema requiring 'id'.{ 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'] } },
- Core helper function implementing prompt retrieval: validates id, reads JSON file from prompts directory, handles not found errors.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 } }
- src/handlers/tools.handler.ts:96-106 (schema)Input schema definition for the get_prompt tool: object with required 'id' string property.inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the prompt to retrieve' } }, required: ['id'] } },