Skip to content

Commit 4cf5ccb

Browse files
authored
Merge pull request #10 from timelfrink/feature/add-activities-endpoint
2 parents 2cb68f0 + 0549884 commit 4cf5ccb

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,17 @@ Parameters:
195195
- Monitor approval requirements
196196
- Track review progress
197197

198+
### `get_activities`
199+
200+
**Retrieve pull request activities**: Gets the complete activity timeline for a pull request including comments, reviews, commits, and other events.
201+
202+
**Use cases:**
203+
- Read comment discussions and feedback
204+
- Review the complete PR timeline
205+
- Track commits added/removed from PR
206+
- See approval and review history
207+
- Understand the full PR lifecycle
208+
198209
## Usage Examples
199210

200211
### Listing Projects and Repositories
@@ -227,6 +238,12 @@ get_pull_request --repository "my-repo" --prId 123
227238

228239
# Merge a pull request with squash strategy
229240
merge_pull_request --repository "my-repo" --prId 123 --strategy "squash" --message "Feature: New functionality (#123)"
241+
242+
# Get pull request activities (comments, reviews, commits, etc.)
243+
get_activities --repository "my-repo" --prId 123
244+
245+
# Get activities for a specific project
246+
get_activities --project "MYPROJECT" --repository "my-repo" --prId 123
230247
```
231248

232249
## Dependencies

src/index.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,19 @@ class BitbucketServer {
266266
},
267267
required: ['repository', 'prId']
268268
}
269+
},
270+
{
271+
name: 'get_activities',
272+
description: 'Retrieve all activities for a pull request including comments, reviews, commits, and other timeline events. Use this to get the complete activity history and timeline of the pull request.',
273+
inputSchema: {
274+
type: 'object',
275+
properties: {
276+
project: { type: 'string', description: 'Bitbucket project key. If omitted, uses BITBUCKET_DEFAULT_PROJECT environment variable.' },
277+
repository: { type: 'string', description: 'Repository slug containing the pull request.' },
278+
prId: { type: 'number', description: 'Pull request ID to get activities for.' }
279+
},
280+
required: ['repository', 'prId']
281+
}
269282
}
270283
]
271284
}));
@@ -375,6 +388,15 @@ class BitbucketServer {
375388
return await this.getReviews(reviewsPrParams);
376389
}
377390

391+
case 'get_activities': {
392+
const activitiesPrParams: PullRequestParams = {
393+
project: getProject(args.project as string),
394+
repository: args.repository as string,
395+
prId: args.prId as number
396+
};
397+
return await this.getActivities(activitiesPrParams);
398+
}
399+
378400
default:
379401
throw new McpError(
380402
ErrorCode.MethodNotFound,
@@ -638,6 +660,25 @@ class BitbucketServer {
638660
};
639661
}
640662

663+
private async getActivities(params: PullRequestParams) {
664+
const { project, repository, prId } = params;
665+
666+
if (!project || !repository || !prId) {
667+
throw new McpError(
668+
ErrorCode.InvalidParams,
669+
'Project, repository, and prId are required'
670+
);
671+
}
672+
673+
const response = await this.api.get(
674+
`/projects/${project}/repos/${repository}/pull-requests/${prId}/activities`
675+
);
676+
677+
return {
678+
content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }]
679+
};
680+
}
681+
641682
async run() {
642683
const transport = new StdioServerTransport();
643684
await this.server.connect(transport);

0 commit comments

Comments
 (0)