search_sourcegraph
Search code across your SourceGraph instance using text, patterns, or regular expressions. Filter by repository, file, language, and more for precise results.
Instructions
General code search across your SourceGraph instance. Use this for text-based searches, finding patterns, or when you need to search for more than just symbol definitions.
Supports full SourceGraph query syntax including:
repo:owner/name- Filter by repositoryfile:pattern- Filter by file pathlang:language- Filter by programming languagecase:yes- Case-sensitive searchRegular expressions and literals
Examples:
'PlaceOrder lang:csharp' - Find PlaceOrder in C# files
'repo:myorg/myrepo TODO' - Find TODOs in a specific repo
'file:.py$ import pandas' - Find pandas imports in Python files
'error handling lang:java' - Search for error handling in Java
Note: For finding symbol definitions or references specifically, use find_symbol_definition or find_symbol_references for faster, more accurate results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query using SourceGraph syntax | |
| max_results | No | Maximum number of results (default: 10) |