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
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query |
Implementation Reference
- src/prompts/prompts.ts:173-204 (registration)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 ), }, ], }; } );
- src/prompts/prompts.ts:179-203 (handler)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 ), }, ], }; }
- src/core/prompt-manager.ts:211-219 (helper)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)) ); }