bitbucket_search_commits
Find commits by searching their messages in a Bitbucket repository. Specify project key, repo slug, and query to retrieve matching commits.
Instructions
Search commits by message
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | Project key | |
| repo | Yes | Repository slug | |
| query | Yes | Search query | |
| limit | No | Max results | |
| start | No | Pagination start |
Implementation Reference
- src/tools/search-tools.ts:54-86 (handler)Handler function for bitbucket_search_commits tool. Parses input args with searchCommitsShape, requires 'search_code' permission, calls searchApi.searchCommits(), and returns text result or error.
bitbucket_search_commits: async (args: unknown): Promise<McpToolResult> => { const start = Date.now(); try { const input = z.object(searchCommitsShape).parse(args); requirePermission(config, 'search_code'); log('info', 'tool start', { operation: 'tool_execute', toolName: 'bitbucket_search_commits', }); const result = await searchApi.searchCommits( input.project, input.repo, input.query, input.limit, input.start ); log('info', 'tool end', { toolName: 'bitbucket_search_commits', durationMs: Date.now() - start, }); return textResult(result); } catch (err) { log('error', 'tool error', { toolName: 'bitbucket_search_commits', error: String(err), durationMs: Date.now() - start, }); return errorResult( 'SEARCH_COMMITS_FAILED', err instanceof Error ? err.message : String(err) ); } }, - src/tools/schemas.ts:94-99 (schema)Input schema definition for searchCommitsShape: includes project, repo (from repoRefShape), query (string 1-500 chars), limit, and start.
export const searchCommitsShape = { ...repoRefShape, query: z.string().min(1).max(500).describe('Search query'), limit, start, } as const; - src/tools/registry.ts:169-174 (registration)Tool registration entry mapping name 'bitbucket_search_commits' to description, searchCommitsShape schema, and handler h.search.bitbucket_search_commits.
{ name: 'bitbucket_search_commits', description: 'Search commits by message', shape: searchCommitsShape, handler: h.search.bitbucket_search_commits, }, - src/bitbucket/api/search.ts:22-33 (helper)SearchApi.searchCommits() method that makes HTTP GET request to /projects/{project}/repos/{repo}/commits with query, limit, start parameters.
async searchCommits( project: string, repo: string, query: string, limit = 25, start = 0 ): Promise<BitbucketPagedResponse<{ readonly id: string; readonly message: string }>> { return this.client.requestJson(`/projects/${project}/repos/${repo}/commits`, { queryParams: { query, limit, start }, }); } }