list_prompts
Browse and discover available prompts in Promptopia MCP to find suitable templates for your AI interactions.
Instructions
Lists all available prompts
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_prompts"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/tools.handler.ts:239-247 (handler)Handler execution for the 'list_prompts' tool: fetches prompts from service and returns them as JSON text content.
case 'list_prompts': { const prompts = await this.promptsService.listPrompts() return { content: [{ type: 'text', text: JSON.stringify({ prompts }, null, 2) }] } } - src/handlers/tools.handler.ts:107-114 (registration)Registration of the 'list_prompts' tool in the tools list returned by listTools() method.
{ name: 'list_prompts', description: 'Lists all available prompts', inputSchema: { type: 'object', properties: {} } }, - Core implementation of listing prompts by reading JSON files from the prompts directory.
async listPrompts(): Promise<Prompt[]> { try { const files = await this.fileSystemService.listFiles(this.promptsDir, '.json') const prompts: Prompt[] = [] for (const file of files) { try { const filePath = path.join(this.promptsDir, file) const prompt = await this.fileSystemService.readJSONFile<Prompt>(filePath) prompts.push(prompt) } catch (error) { console.error(`Error reading prompt file ${file}:`, error) // Continue with other files even if one fails } } return prompts } catch (error) { console.error('Failed to list prompts:', error) throw error } }