search_code
Search for code across Bitbucket repositories using natural language queries to locate specific files, functions, or patterns within a workspace.
Instructions
Search for code in a workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| query | Yes | The search query |
Implementation Reference
- src/BitbucketClient.ts:199-204 (handler)The actual implementation of the search_code tool in the BitbucketClient class.
async searchCode(workspace: string, query: string): Promise<any[]> { const response = await this.api.get(`/workspaces/${workspace}/search/code`, { params: { search_query: query } }); return response.data.values; } - src/index.ts:343-360 (schema)The definition and input schema for the search_code tool.
{ name: 'search_code', description: 'Search for code in a workspace', inputSchema: { type: 'object', properties: { workspace: { type: 'string', description: 'The workspace slug', }, query: { type: 'string', description: 'The search query', }, }, required: ['workspace', 'query'], }, }, - src/index.ts:633-645 (registration)The tool execution handler in index.ts which calls the client method.
case 'search_code': { const { workspace, query } = args as { workspace: string; query: string; }; const results = await client.searchCode(workspace, query); return { content: [ { type: 'text', text: JSON.stringify(results, null, 2), }, ],