Skip to content

Commit 7f23c83

Browse files
committed
add activities and statuses tools
1 parent 9d37423 commit 7f23c83

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

src/tools/index.civet

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export * from ./list-pipeline-steps.civet
2020
export * from ./list-pipelines.civet
2121
export * from ./list-pull-request-comments.civet
2222
export * from ./list-pull-request-commits.civet
23+
export * from ./list-pull-request-statuses.civet
24+
export * from ./list-pull-request-activities.civet
2325
export * from ./list-pull-request-tasks.civet
2426
export * from ./list-pull-requests.civet
2527
export * from ./list-refs.civet
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ z } from zod
2+
3+
{ BitbucketToolDeclaration } from ../bitbucket.civet
4+
5+
export listPullRequestActivitiesTool := new BitbucketToolDeclaration {
6+
name: "list-pull-request-activities",
7+
config: {
8+
title: "List pull request activities",
9+
description: "List activities associated with a pull request. Useful for tracking PR review items and action items.",
10+
inputSchema: {
11+
workspace: z.string().describe("The Bitbucket workspace name or UUID where the repository is located"),
12+
repository: z.string().describe("The repository name or UUID containing the pull request"),
13+
pullRequestId: z.number().describe("The unique identifier of the pull request to list activities from"),
14+
fields: z.string().optional().describe("Comma-separated list of fields to include in the response"),
15+
page: z.string().optional().describe("Page token for pagination"),
16+
pagelen: z.number().optional().describe("Number of items to return per page (default: 10, max: 100)"),
17+
q: z.string().optional().describe("Query string to filter activities"),
18+
sort: z.string().optional().describe("Field to sort results by (e.g., \"created_on\", \"-created_on\")"),
19+
},
20+
},
21+
run({ workspace, repository, pullRequestId, fields, page, pagelen, q, sort }) {
22+
// Get PR activities
23+
activities := @bitbucket.repositories
24+
|> .listPullRequestActivities {
25+
pull_request_id: pullRequestId,
26+
repo_slug: repository,
27+
workspace,
28+
fields,
29+
page,
30+
pagelen,
31+
q,
32+
sort
33+
}
34+
|> await
35+
|> .data
36+
37+
// Return the activities
38+
activities
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ z } from zod
2+
3+
{ BitbucketToolDeclaration } from ../bitbucket.civet
4+
5+
export listPullRequestStatusesTool := new BitbucketToolDeclaration {
6+
name: "list-pull-request-statuses",
7+
config: {
8+
title: "List pull request statuses",
9+
description: "List statuses associated with a pull request. Useful for tracking PR review items and action items.",
10+
inputSchema: {
11+
workspace: z.string().describe("The Bitbucket workspace name or UUID where the repository is located"),
12+
repository: z.string().describe("The repository name or UUID containing the pull request"),
13+
pullRequestId: z.number().describe("The unique identifier of the pull request to list statuses from"),
14+
fields: z.string().optional().describe("Comma-separated list of fields to include in the response"),
15+
page: z.string().optional().describe("Page token for pagination"),
16+
pagelen: z.number().optional().describe("Number of items to return per page (default: 10, max: 100)"),
17+
q: z.string().optional().describe("Query string to filter statuses"),
18+
sort: z.string().optional().describe("Field to sort results by (e.g., \"created_on\", \"-created_on\")"),
19+
},
20+
},
21+
run({ workspace, repository, pullRequestId, fields, page, pagelen, q, sort }) {
22+
// Get PR statuses
23+
statuses := @bitbucket.repositories
24+
|> .listPullRequestStatuses {
25+
pull_request_id: pullRequestId,
26+
repo_slug: repository,
27+
workspace,
28+
fields,
29+
page,
30+
pagelen,
31+
q,
32+
sort
33+
}
34+
|> await
35+
|> .data
36+
37+
// Return the statuses
38+
statuses
39+
}
40+
}

0 commit comments

Comments
 (0)