Skip to main content
Glama

search_prompts

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

Instructions

Search for prompt templates by query string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query

Implementation Reference

  • Registers the 'search_prompts' MCP tool with the server. Defines the tool name, description, input schema (query: z.string()), and handler function that performs the search using registry.prompts.search() and returns formatted JSON results including matching prompts' metadata.
    "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 ), }, ], }; } );
  • The handler function for the 'search_prompts' tool. Takes args.query, calls registry.prompts.search(), and returns MCP-formatted content with query, count, and results (id, name, description, category, tags).
    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 ), }, ], }; }
  • Core search implementation in PromptManager class. Performs case-insensitive substring search on prompt name, description, and 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