Skip to content

Commit ad71d44

Browse files
committed
add all read-only tools i could think of
1 parent 7ac34f9 commit ad71d44

32 files changed

+910
-99
lines changed

docs.md

Lines changed: 287 additions & 14 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "bitbucket-mcp-server",
33
"private": true,
4-
"version": "0.0.1",
4+
"version": "0.0.2",
55
"main": "src/index.civet",
66
"license": "MIT",
77
"scripts": {

readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ bun inspect username:password
114114

115115
This will open the MCP Inspector with a GUI to play around and explore the MCP tools.
116116

117+
## MCP tools limitation
118+
119+
MCP has a limitation of 40 tools that will be sent to the agent.
120+
121+
Currently `bitbucket-mcp-server` provides 24 tools total. Consider disabling the ones you don't use often to save some slots.
122+
117123
---
118124

119125
This project was created using `bun init` in bun v1.2.17. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

src/tools/get-issue-comment.civet

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{ z } from zod
2+
3+
{ BitbucketToolDeclaration } from ../bitbucket.civet
4+
5+
export getIssueCommentTool := new BitbucketToolDeclaration {
6+
name: "get-issue-comment",
7+
config: {
8+
title: "Get issue comment",
9+
description: "Get detailed information about a specific comment on an issue.",
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 issue"),
13+
issueId: z.string().describe("The unique identifier of the issue containing the comment"),
14+
commentId: z.number().describe("The unique identifier of the specific comment to retrieve"),
15+
fields: z.string().optional().describe("Comma-separated list of fields to include in the response"),
16+
},
17+
},
18+
run({ workspace, repository, issueId, commentId, fields }) {
19+
// Get the issue comment
20+
comment := @bitbucket.repositories
21+
|> .getIssueComment {
22+
workspace,
23+
repo_slug: repository,
24+
issue_id: issueId,
25+
comment_id: commentId,
26+
fields
27+
}
28+
|> await
29+
|> .data
30+
31+
// Return the comment
32+
comment
33+
}
34+
}

src/tools/get-issue.civet

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{ z } from zod
2+
3+
{ BitbucketToolDeclaration } from ../bitbucket.civet
4+
5+
export getIssueTool := new BitbucketToolDeclaration {
6+
name: "get-issue",
7+
config: {
8+
title: "Get issue",
9+
description: "Get detailed information about a specific issue in a repository.",
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 issue"),
13+
issueId: z.string().describe("The unique identifier of the issue to retrieve"),
14+
fields: z.string().optional().describe("Comma-separated list of fields to include in the response"),
15+
},
16+
},
17+
run({ workspace, repository, issueId, fields }) {
18+
// Get the issue
19+
issue := @bitbucket.repositories
20+
|> .getIssue {
21+
workspace,
22+
repo_slug: repository,
23+
issue_id: issueId,
24+
fields
25+
}
26+
|> await
27+
|> .data
28+
29+
// Return the issue
30+
issue
31+
}
32+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{ z } from zod
2+
3+
{ BitbucketToolDeclaration } from ../bitbucket.civet
4+
5+
export getPipelineStepLogsTool := new BitbucketToolDeclaration {
6+
name: "get-pipeline-step-logs",
7+
config: {
8+
title: "Get pipeline step logs",
9+
description: "Get the execution logs for a specific pipeline step. Essential for debugging failed builds and understanding execution details.",
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 pipeline"),
13+
pipelineUuid: z.string().describe("The unique identifier (UUID) of the pipeline containing the step"),
14+
stepUuid: z.string().describe("The unique identifier (UUID) of the step to get logs for"),
15+
fields: z.string().optional().describe("Comma-separated list of fields to include in the response"),
16+
},
17+
},
18+
run({ workspace, repository, pipelineUuid, stepUuid, fields }) {
19+
// Get the pipeline step logs
20+
logs := @bitbucket.repositories
21+
|> .getPipelineStepLog {
22+
workspace,
23+
repo_slug: repository,
24+
pipeline_uuid: pipelineUuid,
25+
step_uuid: stepUuid,
26+
fields
27+
}
28+
|> await
29+
|> .data
30+
31+
// Return the logs
32+
logs
33+
}
34+
}

src/tools/get-pipeline-step.civet

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{ z } from zod
2+
3+
{ BitbucketToolDeclaration } from ../bitbucket.civet
4+
5+
export getPipelineStepTool := new BitbucketToolDeclaration {
6+
name: "get-pipeline-step",
7+
config: {
8+
title: "Get pipeline step",
9+
description: "Get detailed information about a specific step within a pipeline run, including execution status and timing.",
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 pipeline"),
13+
pipelineUuid: z.string().describe("The unique identifier (UUID) of the pipeline containing the step"),
14+
stepUuid: z.string().describe("The unique identifier (UUID) of the specific step to retrieve"),
15+
fields: z.string().optional().describe("Comma-separated list of fields to include in the response"),
16+
},
17+
},
18+
run({ workspace, repository, pipelineUuid, stepUuid, fields }) {
19+
// Get the pipeline step
20+
step := @bitbucket.repositories
21+
|> .getPipelineStep {
22+
workspace,
23+
repo_slug: repository,
24+
pipeline_uuid: pipelineUuid,
25+
step_uuid: stepUuid,
26+
fields
27+
}
28+
|> await
29+
|> .data
30+
31+
// Return the step
32+
step
33+
}
34+
}

src/tools/get-pipeline.civet

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{ z } from zod
2+
3+
{ BitbucketToolDeclaration } from ../bitbucket.civet
4+
5+
export getPipelineTool := new BitbucketToolDeclaration {
6+
name: "get-pipeline",
7+
config: {
8+
title: "Get pipeline",
9+
description: "Get detailed information about a specific pipeline run, including status, duration, and metadata.",
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 pipeline"),
13+
pipelineUuid: z.string().describe("The unique identifier (UUID) of the pipeline to retrieve"),
14+
fields: z.string().optional().describe("Comma-separated list of fields to include in the response"),
15+
},
16+
},
17+
run({ workspace, repository, pipelineUuid, fields }) {
18+
// Get the pipeline
19+
pipeline := @bitbucket.repositories
20+
|> .getPipeline {
21+
workspace,
22+
repo_slug: repository,
23+
pipeline_uuid: pipelineUuid,
24+
fields
25+
}
26+
|> await
27+
|> .data
28+
29+
// Return the pipeline
30+
pipeline
31+
}
32+
}

src/tools/get-pull-request-comment.civet

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ export getPullRequestCommentTool := new BitbucketToolDeclaration {
88
title: "Get pull request comment",
99
description: "Get a pull request comment",
1010
inputSchema: {
11-
workspace: z.string(),
12-
repository: z.string(),
13-
pullRequestId: z.number(),
14-
commentId: z.number(),
15-
fields: z.string().optional(),
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 containing the comment"),
14+
commentId: z.number().describe("The unique identifier of the specific comment to retrieve"),
15+
fields: z.string().optional().describe("Comma-separated list of fields to include in the response"),
1616
},
1717
},
1818
run({ workspace, repository, pullRequestId, commentId, fields }) {

src/tools/get-pull-request-diff.civet

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export getPullRequestDiffTool := new BitbucketToolDeclaration {
88
title: "Get pull request diff",
99
description: "Get a pull request diff",
1010
inputSchema: {
11-
pullRequestId: z.number(),
12-
repository: z.string(),
13-
workspace: z.string(),
14-
fields: z.string().optional(),
11+
pullRequestId: z.number().describe("The unique identifier of the pull request to get the diff for"),
12+
repository: z.string().describe("The repository name or UUID containing the pull request"),
13+
workspace: z.string().describe("The Bitbucket workspace name or UUID where the repository is located"),
14+
fields: z.string().optional().describe("Comma-separated list of fields to include in the response"),
1515
},
1616
},
1717
run({ pullRequestId, repository, workspace, fields }) {

0 commit comments

Comments
 (0)