search_bitbucket
Search Bitbucket repositories and code to find specific projects or code snippets using customizable queries and result limits.
Instructions
Search Bitbucket repositories and code
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for Bitbucket repositories | |
| maxResults | No | Maximum number of results to return |
Implementation Reference
- The execute handler implementing the core logic of search_bitbucket tool. Parses input, generates simulated Bitbucket repository search results, and returns structured ToolOutput.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/tools/tech/gitlab-bitbucket-tools.ts:75-138 (registration)The registry.registerTool call that defines and registers the search_bitbucket tool, including name, description, schema, and handler reference.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 }; } } });
- Input schema defining the expected parameters for the search_bitbucket tool: query (required string) and maxResults (optional number, 1-100).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/index.ts:238-238 (registration)Top-level registration call in the main server initialization that invokes registerGitLabBitbucketTools, thereby registering search_bitbucket among others.registerGitLabBitbucketTools(this.toolRegistry); // 2 tools: search_gitlab, search_bitbucket
- src/utils/input-validator.ts:246-246 (schema)Additional runtime input validation schema mapping for search_bitbucket using the basicSearch Zod schema in the global input validator.'search_bitbucket': ToolSchemas.basicSearch,