search_bitbucket
Search Bitbucket repositories and code using a query, with customizable result limits, powered by Open Search MCP for efficient and precise code discovery.
Instructions
Search Bitbucket repositories and code
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxResults | No | Maximum number of results to return | |
| query | Yes | Search query for Bitbucket repositories |
Implementation Reference
- src/tools/tech/gitlab-bitbucket-tools.ts:75-138 (registration)Registration of the 'search_bitbucket' tool in the ToolRegistry, including name, description, input schema, and the execute handler function.registry.registerTool({ name: 'search_bitbucket', description: 'Search Bitbucket repositories and code', category: 'developer', source: 'Bitbucket', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for Bitbucket repositories' }, maxResults: { type: 'number', description: 'Maximum number of results to return', default: 20, minimum: 1, maximum: 100 } }, required: ['query'] }, execute: async (args: ToolInput): Promise<ToolOutput> => { try { const { query, maxResults = 20 } = args; // Simulated Bitbucket search results const results = Array.from({ length: Math.min(maxResults, 10) }, (_, i) => ({ name: `${query}-repo-${i + 1}`, fullName: `team${i + 1}/${query}-repo-${i + 1}`, description: `A Bitbucket repository for ${query} development`, url: `https://bitbucket.org/team${i + 1}/${query}-repo-${i + 1}`, language: ['TypeScript', 'Python', 'Java', 'C#', 'PHP'][i % 5], size: Math.floor(Math.random() * 10000), lastUpdated: new Date(Date.now() - Math.random() * 60 * 24 * 60 * 60 * 1000).toISOString(), isPrivate: i % 4 === 0, owner: `team${i + 1}`, cloneUrl: `https://bitbucket.org/team${i + 1}/${query}-repo-${i + 1}.git`, issues: Math.floor(Math.random() * 50), pullRequests: Math.floor(Math.random() * 20) })); return { success: true, data: { source: 'Bitbucket', query, results, totalResults: results.length }, metadata: { searchTime: Date.now(), source: 'Bitbucket API' } }; } catch (error) { return { success: false, error: `Bitbucket search failed: ${error instanceof Error ? error.message : String(error)}`, data: null }; } } });
- The execute handler for 'search_bitbucket' that processes the input query, generates simulated Bitbucket repository search results (up to 10), and returns structured output with success status, data, and metadata.execute: async (args: ToolInput): Promise<ToolOutput> => { try { const { query, maxResults = 20 } = args; // Simulated Bitbucket search results const results = Array.from({ length: Math.min(maxResults, 10) }, (_, i) => ({ name: `${query}-repo-${i + 1}`, fullName: `team${i + 1}/${query}-repo-${i + 1}`, description: `A Bitbucket repository for ${query} development`, url: `https://bitbucket.org/team${i + 1}/${query}-repo-${i + 1}`, language: ['TypeScript', 'Python', 'Java', 'C#', 'PHP'][i % 5], size: Math.floor(Math.random() * 10000), lastUpdated: new Date(Date.now() - Math.random() * 60 * 24 * 60 * 60 * 1000).toISOString(), isPrivate: i % 4 === 0, owner: `team${i + 1}`, cloneUrl: `https://bitbucket.org/team${i + 1}/${query}-repo-${i + 1}.git`, issues: Math.floor(Math.random() * 50), pullRequests: Math.floor(Math.random() * 20) })); return { success: true, data: { source: 'Bitbucket', query, results, totalResults: results.length }, metadata: { searchTime: Date.now(), source: 'Bitbucket API' } }; } catch (error) { return { success: false, error: `Bitbucket search failed: ${error instanceof Error ? error.message : String(error)}`, data: null }; } }
- src/index.ts:238-238 (registration)Call to registerGitLabBitbucketTools in the main server initialization, which registers both 'search_gitlab' and 'search_bitbucket' tools.registerGitLabBitbucketTools(this.toolRegistry); // 2 tools: search_gitlab, search_bitbucket
- Input schema definition for the 'search_bitbucket' tool, specifying required 'query' string and optional 'maxResults' number (1-100, default 20).inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for Bitbucket repositories' }, maxResults: { type: 'number', description: 'Maximum number of results to return', default: 20, minimum: 1, maximum: 100 } }, required: ['query'] },
- src/utils/input-validator.ts:246-246 (schema)Reference to basicSearch schema in input validator for validating 'search_bitbucket' tool inputs.'search_bitbucket': ToolSchemas.basicSearch,