Skip to main content
Glama
lumile

Promptopia MCP

by lumile

list_prompts

Discover and access all available prompts on Promptopia MCP to streamline your workflow and enhance your prompt-based tasks.

Instructions

Lists all available prompts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execution logic for the 'list_prompts' tool in the callTool method. It invokes the PromptsService.listPrompts() and returns the result as a formatted JSON text response in MCP content format.
    case 'list_prompts': { const prompts = await this.promptsService.listPrompts() return { content: [{ type: 'text', text: JSON.stringify({ prompts }, null, 2) }] } }
  • Tool registration metadata for 'list_prompts' in the listTools() method, including name, description, and empty input schema.
    { name: 'list_prompts', description: 'Lists all available prompts', inputSchema: { type: 'object', properties: {} } },
  • Core helper method in PromptsService that lists all 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 } }
  • Helper method in PromptsHandler that lists prompts and converts them to MCP format, used for MCP native prompts/list request.
    async listPrompts(): Promise<{ prompts: McpPrompt[] }> { try { const prompts = await this.promptsService.listPrompts() // Convert internal prompts to MCP prompt format const mcpPrompts = prompts.map(prompt => this.toMcpPrompt(prompt)) return { prompts: mcpPrompts } } catch (error) { const mcpError = handleServiceError(error) throw mcpError } }
  • src/index.ts:68-73 (registration)
    MCP server registration for the native 'prompts/list' request using ListPromptsRequestSchema, which calls PromptsHandler.listPrompts().
    this.server.setRequestHandler( ListPromptsRequestSchema, async () => { const result = await this.promptsHandler!.listPrompts() return { ...result, _meta: {} } }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lumile/promptopia-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server