search_prompts tool executes a PostgreSQL full-text search across prompt titles, descriptions, and content. It uses the same search infrastructure as the PromptRepo web UI.
Access Control
- Authenticated users: Searches across their own prompts (public or private) plus public prompts from other users
- Anonymous callers: Searches only public prompts
- Archived prompts: Never included in search results
Parameters
Search query text. Must be at least 1 character long. Supports PostgreSQL full-text search syntax including:
- Multiple words (AND logic by default)
- Phrase matching with quotes:
"exact phrase" - OR operator:
typescript OR javascript - NOT operator:
code -review
Maximum number of results to return. Must be between 1 and 50.
Response
Returns aSearchPromptsResult with matching prompts (same structure as list_prompts).
Examples
Basic Search
Request:Advanced Search with Operators
Request with OR operator:Implementation Details
- Executes the
search_promptsPostgreSQL RPC function (same as UI search) - Uses
tsvectorfull-text indexes onpromptstable for performance - The search index is automatically updated by a database trigger (
update_prompt_search_tokens) - Results are ranked by PostgreSQL’s
ts_rankrelevance scoring - Access control is enforced in application code after the database query
- Variables are extracted from the
latest_contentfield returned by the search function
Search Behavior
- Case-insensitive: Searches ignore case differences
- Stemming: PostgreSQL applies English language stemming (e.g., “reviewing” matches “review”)
- Indexed fields: Searches across prompt title, description, and content
- Relevance ranking: Results are ordered by how well they match the query
- Trimmed query: Leading/trailing whitespace is automatically removed
Error Codes
Invalid parameters:
query is empty or missing, or limit is out of rangeSearch RPC function failed or database error occurred
Related Tools
- Use
list_promptsto browse all accessible prompts without filtering - Use
get_promptto retrieve full details for a specific result - Use
resolve_promptto use a found prompt with variable substitution