search_code
Find code snippets across Bitbucket repositories using context-aware search patterns. Filter by workspace, repository, file type, or specific code contexts like assignments, declarations, or usages.
Instructions
Search for code across Bitbucket repositories with enhanced context-aware search patterns (currently only supported for Bitbucket Server)
Input Schema
Name | Required | Description | Default |
---|---|---|---|
file_pattern | No | File path pattern to filter results (e.g., "*.java", "src/**/*.ts") (optional) | |
include_patterns | No | Additional custom search patterns to include (e.g., ["variable =", ".variable"]) (optional) | |
limit | No | Maximum number of results to return (default: 25) | |
repository | No | Repository slug to search in (optional, searches all repos if not specified) | |
search_context | No | Context to search for: assignment (term=value), declaration (defining term), usage (calling/accessing term), exact (quoted match), or any (all patterns) | |
search_query | Yes | The search term or phrase to look for in code (e.g., "variable") | |
start | No | Start index for pagination (default: 0) | |
workspace | Yes | Bitbucket workspace/project key (e.g., "PROJ") |
Input Schema (JSON Schema)
{
"properties": {
"file_pattern": {
"description": "File path pattern to filter results (e.g., \"*.java\", \"src/**/*.ts\") (optional)",
"type": "string"
},
"include_patterns": {
"description": "Additional custom search patterns to include (e.g., [\"variable =\", \".variable\"]) (optional)",
"items": {
"type": "string"
},
"type": "array"
},
"limit": {
"description": "Maximum number of results to return (default: 25)",
"type": "number"
},
"repository": {
"description": "Repository slug to search in (optional, searches all repos if not specified)",
"type": "string"
},
"search_context": {
"description": "Context to search for: assignment (term=value), declaration (defining term), usage (calling/accessing term), exact (quoted match), or any (all patterns)",
"enum": [
"assignment",
"declaration",
"usage",
"exact",
"any"
],
"type": "string"
},
"search_query": {
"description": "The search term or phrase to look for in code (e.g., \"variable\")",
"type": "string"
},
"start": {
"description": "Start index for pagination (default: 0)",
"type": "number"
},
"workspace": {
"description": "Bitbucket workspace/project key (e.g., \"PROJ\")",
"type": "string"
}
},
"required": [
"workspace",
"search_query"
],
"type": "object"
}