Skip to main content
Glama
tanker327

Prompts MCP Server

by tanker327

list_prompts

Retrieve a comprehensive list of all available prompt templates from the Prompts MCP Server to streamline access and management of structured prompts for workflows.

Instructions

List all available prompts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler for the 'list_prompts' tool. It retrieves the list of prompts using fileOps.listPrompts(), handles empty case, formats the output using formatPromptsList, and returns it as MCP CallToolResult.
    private async handleListPrompts(): Promise<CallToolResult> { const prompts = await this.fileOps.listPrompts(); if (prompts.length === 0) { return { content: [ { type: 'text', text: 'No prompts available', } as TextContent, ], }; } const text = this.formatPromptsList(prompts); return { content: [ { type: 'text', text, } as TextContent, ], }; }
  • src/tools.ts:59-66 (registration)
    Tool registration in getToolDefinitions(), including the tool name 'list_prompts', description, and input schema (no required parameters).
    { name: 'list_prompts', description: 'List all available prompts', inputSchema: { type: 'object', properties: {}, }, },
  • Input schema definition for list_prompts tool: empty object, indicating no input parameters needed.
    inputSchema: { type: 'object', properties: {}, },
  • Core helper method listPrompts() in PromptFileOperations class that initializes the prompt cache if necessary and returns the list of all prompts from the cache.
    async listPrompts(): Promise<PromptInfo[]> { // Initialize cache and file watcher if not already done if (this.cache.isEmpty()) { await this.cache.initializeCache(); this.cache.initializeFileWatcher(); } return this.cache.getAllPrompts(); }
  • Helper function to format the list of prompts into a structured Markdown output with sections for each prompt's metadata and preview.
    private formatPromptsList(prompts: PromptInfo[]): string { const formatPrompt = (prompt: PromptInfo): string => { let output = `## ${prompt.name}\n`; if (Object.keys(prompt.metadata).length > 0) { output += '**Metadata:**\n'; Object.entries(prompt.metadata).forEach(([key, value]) => { output += `- ${key}: ${value}\n`; }); output += '\n'; } output += `**Preview:** ${prompt.preview}\n`; return output; }; return `# Available Prompts\n\n${prompts.map(formatPrompt).join('\n---\n\n')}`; }

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/tanker327/prompts-mcp-server'

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