Search
Search Context7 documentation in one request. Context7 selects relevant libraries, searches them in parallel, and returns the best snippets together. The SDK returns structured JSON by default, consistent with its other methods. Settype to txt when you need plain text for an LLM prompt. The REST endpoint defaults to text unless you request type=json.
Arguments
string
required
The question or task to search for. Specific, natural language questions produce the best results.
SearchOptions
Text response
JSON response
JSON responses return aSearchResponse object with codeSnippets, infoSnippets, and optional rules. Each snippet includes the libraryId that it came from.
Version-specific search
Use a library hint withversion when your question depends on a particular release.
client.search() throws Context7Error with status 404. A temporary search failure returns status 503 and follows the SDK retry policy.