Skip to main content
Glama

search_prompts

Find prompt templates for productivity automation by entering a search query to access reusable templates for tasks like planning, code review, and summarization.

Instructions

Search for prompt templates by query string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query

Implementation Reference

  • MCP tool handler for 'search_prompts': invokes registry.prompts.search(query) and formats results as JSON.
    async (args) => { const prompts = registry.prompts.search(args.query); return { content: [ { type: "text", text: JSON.stringify( { query: args.query, count: prompts.length, results: prompts.map((p) => ({ id: p.id, name: p.name, description: p.description, category: p.category, tags: p.tags, })), }, null, 2 ), }, ], }; }
  • Zod input schema defining the 'query' parameter as a required string.
    query: z.string().describe("Search query"), },
  • Registers the 'search_prompts' tool on the MCP server within registerPromptTools function.
    server.tool( "search_prompts", "Search for prompt templates by query string", { query: z.string().describe("Search query"), }, async (args) => { const prompts = registry.prompts.search(args.query); return { content: [ { type: "text", text: JSON.stringify( { query: args.query, count: prompts.length, results: prompts.map((p) => ({ id: p.id, name: p.name, description: p.description, category: p.category, tags: p.tags, })), }, null, 2 ), }, ], }; } );
  • Implements the prompt search logic by filtering templates matching the query in name, description, or tags.
    search(query: string): PromptTemplate[] { const lowerQuery = query.toLowerCase(); return Array.from(this.templates.values()).filter( (t) => t.name.toLowerCase().includes(lowerQuery) || t.description.toLowerCase().includes(lowerQuery) || t.tags?.some((tag) => tag.toLowerCase().includes(lowerQuery)) ); }

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/ishuru/open-mcp'

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