search_prompts
Find development prompts for UI/UX design, project setup, and debugging by searching with keywords or tags to enhance AI-powered workflows.
Instructions
Search for prompts by keyword or tag
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query |
Implementation Reference
- src/server.ts:178-197 (handler)Handler for the 'search_prompts' tool: validates input query, calls promptManager.searchPrompts, logs results, and returns JSON-formatted search results.case "search_prompts": if (!args || typeof args.query !== "string") { throw new McpError( ErrorCode.InvalidRequest, "Query parameter is required" ); } const results = await this.promptManager.searchPrompts(args.query); logger.info( `Search results for "${args.query}": ${results.length} prompts` ); return { content: [ { type: "text", text: JSON.stringify(results, null, 2), }, ], };
- src/prompt-manager.ts:151-191 (helper)Core implementation of prompt search: computes relevance score based on matches in title (3pts), description (2pts), tags (1pt), category (1pt), sorts by score descending.async searchPrompts(query: string): Promise<PromptWithScore[]> { const lowercaseQuery = query.toLowerCase(); const results: PromptWithScore[] = []; for (const prompt of this.prompts.values()) { let score = 0; // Check title if (prompt.title.toLowerCase().includes(lowercaseQuery)) { score += 3; } // Check description if ( prompt.description && prompt.description.toLowerCase().includes(lowercaseQuery) ) { score += 2; } // Check tags if ( prompt.tags && prompt.tags.some((tag) => tag.toLowerCase().includes(lowercaseQuery)) ) { score += 1; } // Check category if (prompt.category.toLowerCase().includes(lowercaseQuery)) { score += 1; } if (score > 0) { results.push({ ...prompt, searchScore: score }); } } // Sort by score (descending) return results.sort((a, b) => b.searchScore - a.searchScore); }
- src/prompt-types.ts:55-57 (schema)Type definition for the input schema of the search_prompts tool, specifying the required 'query' string parameter.export interface SearchPromptsRequest { query: string; }