比特桶MCP服务器
](https://www.npmjs.com/package/@nexus2520/bitbucket-mcp-server) 
一种MCP(模型上下文协议)服务器,提供与Bitbucket API交互的工具,同时支持Bitbucket云和Bitbucket服务器。
特性
可用工具(共29个)
公关核心(pr_core)
get_pull_request-完整的PR详细信息,包括评论、文件更改和合并信息list_pull_requests-列出带有过滤器的PR(状态、作者、分页)create_pull_request-创建新的拉取请求update_pull_request-更新PR详细信息(标题、描述、审阅者、目标分支机构)merge_pull_request-使用各种策略合并拉取请求decline_pull_request-拒绝/拒绝拉取请求
PR评论(pr_comments)
add_comment-在PR中添加一般、内联、线程或建议注释delete_comment-从pull请求中删除评论
代码审查(pr_review)
get_pull_request_diff-具有ADDED/REMOVED/CONTEXT类型的结构化逐行差异set_pr_approval-批准(approved: true)或取消批准(approved: false)一个PRset_review_status-请求更改(request_changes: true)或删除请求(false)
PR任务——仅限Bitbucket服务器(pr_tasks)
list_pr_tasks-列出拉取请求中的所有任务create_pr_task-根据pull请求创建新任务update_pr_task-更新现有任务的文本set_pr_task_status-标记任务已完成(done: true)或重新打开它(done: false)delete_pr_task-从拉取请求中删除任务convert_pr_item-将评论转换为任务(direction: "to_task")或返回("to_comment")
承诺(commits)
list_pr_commits-列出拉取请求中的所有提交list_branch_commits-使用日期/作者/消息过滤器列出分支中的提交get_commit_detail-获取SHA特定提交的结构化差异
分支机构(branches)
list_branches-列出具有过滤和分页功能的分支get_branch-详细的分行信息,包括相关的PR和统计数据delete_branch-删除分支
文件(files)
list_directory_content-列出存储库路径中的文件和目录get_file_content-通过智能截断大文件来获取文件内容search_files-按glob模式搜索文件(不区分大小写,如VS代码Ctrl+P)get_file_blame-每行责备:谁最后修改了每一行、提交哈希和作者时间戳(仅限Bitbucket服务器)
搜索--仅限Bitbucket服务器(search)
search_code-使用Bitbucket修饰符进行索引支持的代码搜索(lang:,ext:,path:,archived:,fork:,-term),客户端regex_filter后置过滤器,snake_case↔ 摄像头外壳扇出,以及一个浮出水面的索引探头INDEX_GAP_LIKELY尽管存在匹配的文件,索引仍不返回任何内容find_in_files-通过文件列表进行内容搜索+原始内容扇出。完整的PCRE正则表达式;Bitbucket索引未涵盖的语言或分支;具有速率限制检测和诚实扫描诊断功能search_repositories-按名称、slug或描述搜索存储库
发现(discovery)
list_projects-列出所有可访问的Bitbucket项目/工作区list_repositories-列出项目中或所有可访问项目中的存储库
令牌优化
v2.0.0为每个LLM请求带来了显著的令牌节省:
| 配置 | 暴露的工具 | 估计。代币 |
|---|---|---|
| 比特桶服务器(所有组) | 29 | ~5100 |
| 比特桶云(自动过滤) | 21 | ~3900 |
自定义组预设(例如。 pr_core,pr_review,files) | 12 | ~2,100 |
比特桶云 自动隐藏10个仅限服务器的工具,无需配置。
BITBUCKET_TOOL_GROUPS 允许您仅公开与工作流相关的组——请参阅 工具组筛选 在......下面
安装
使用npx(推荐)
使用此MCP服务器的最简单方法是直接使用npx:
{
"mcpServers": {
"bitbucket": {
"command": "npx",
"args": [
"-y",
"@nexus2520/bitbucket-mcp-server"
],
"env": {
"BITBUCKET_USERNAME": "your-username",
"BITBUCKET_APP_PASSWORD": "your-app-password"
}
}
}
}对于Bitbucket服务器:
{
"mcpServers": {
"bitbucket": {
"command": "npx",
"args": [
"-y",
"@nexus2520/bitbucket-mcp-server"
],
"env": {
"BITBUCKET_USERNAME": "your.email@company.com",
"BITBUCKET_TOKEN": "your-http-access-token",
"BITBUCKET_BASE_URL": "https://bitbucket.yourcompany.com"
}
}
}
}源自
- 克隆或下载此存储库
- 安装依赖项:
npm install- 构建TypeScript代码:
npm run build身份验证设置
此服务器使用Bitbucket应用程序密码进行身份验证。
创建应用程序密码
- 登录您的Bitbucket账户
- 导航到:https://bitbucket.org/account/settings/app-passwords/
- 点击“创建应用密码”
- 给它一个描述性标签(例如“MCP服务器”)
- 选择以下权限:
- 账户:阅读 - 仓库:读,写 - 拉取请求:读,写
- 点击“创建”
- 重要:立即复制生成的密码(您将无法再次看到它!)
运行安装脚本
node scripts/setup-auth.js这将指导您完成身份验证设置过程。
配置
将服务器添加到MCP设置文件(通常位于 ~/.vscode-server/data/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):
{
"mcpServers": {
"bitbucket": {
"command": "node",
"args": ["/absolute/path/to/bitbucket-mcp-server/build/index.js"],
"env": {
"BITBUCKET_USERNAME": "your-username",
"BITBUCKET_APP_PASSWORD": "your-app-password"
}
}
}
}替换:
/absolute/path/to/bitbucket-mcp-server此目录的实际路径your-username使用您的Bitbucket用户名(不是电子邮件)your-app-password使用您创建的应用程序密码
对于Bitbucket服务器,请使用:
{
"mcpServers": {
"bitbucket": {
"command": "node",
"args": ["/absolute/path/to/bitbucket-mcp-server/build/index.js"],
"env": {
"BITBUCKET_USERNAME": "your.email@company.com",
"BITBUCKET_TOKEN": "your-http-access-token",
"BITBUCKET_BASE_URL": "https://bitbucket.yourcompany.com"
}
}
}
}对于Bitbucket服务器用户来说很重要:
- 使用您的完整电子邮件地址作为用户名(例如,“john.doe@company.com")
- 这是批准/审查行动正常工作所必需的
工具组筛选
通过设置,减少每次请求时发送给LLM的工具数量 BITBUCKET_TOOL_GROUPS 以逗号分隔的组名列表。只有列出的组中的工具才会被暴露。
可用组
| 组 | 工具 | 平台 |
|---|---|---|
pr_core | get_pull_request, list_pull_requests, create_pull_request, update_pull_request, merge_pull_request, decline_pull_request | 两者皆有 |
pr_comments | add_comment, delete_comment | 两者皆有 |
pr_review | get_pull_request_diff, set_pr_approval, set_review_status | 两者皆有 |
pr_tasks | list_pr_tasks, create_pr_task, update_pr_task, set_pr_task_status, delete_pr_task, convert_pr_item | 仅限服务器 |
commits | list_pr_commits, list_branch_commits, get_commit_detail | 两者皆有 |
branches | list_branches, get_branch, delete_branch | 两者皆有 |
files | list_directory_content, get_file_content, search_files, get_file_blame (仅限服务器) | 两者都有 |
search | search_code, find_in_files, search_repositories | 仅限服务器 |
discovery | list_projects, list_repositories | 两者皆有 |
预设示例
PR审查工作流程 (约2100个代币):
"env": {
"BITBUCKET_TOOL_GROUPS": "pr_core,pr_review,files"
}全面的公关管理 (约3500个代币):
"env": {
"BITBUCKET_TOOL_GROUPS": "pr_core,pr_comments,pr_review,pr_tasks"
}仅代码探索 (约1400个代币):
"env": {
"BITBUCKET_TOOL_GROUPS": "files,search,discovery"
}当 BITBUCKET_TOOL_GROUPS 如果未设置,则显示所有适用的工具(默认行为)。无论此设置如何,Bitbucket Cloud用户总是会自动隐藏仅限服务器的工具。
用法
配置后,您可以使用可用的工具:
获取拉取请求
{
"tool": "get_pull_request",
"arguments": {
"workspace": "PROJ", // Required - your project key
"repository": "my-repo",
"pull_request_id": 123
}
}返回有关拉取请求的详细信息,包括:
- 标题和说明
- 作者和审稿人
- 源和目标分支
- 审批状态
- 链接到web UI和差异
- 合并提交详细信息 (合并PR时):
- merge_commit_hash:合并提交的哈希值 - merged_by:谁执行了合并 - merged_at:合并发生时 - merge_commit_message:合并提交消息
- 带有嵌套回复的活跃评论 (需要注意的未解决意见):
- active_comments:活跃评论数组(最多20条最新顶级评论) - 评论文本和作者 - 创建日期 - 是否为内联注释(带文件路径和行号) - 嵌套回复 (适用于Bitbucket服务器): - replies:具有相同结构的回复评论数组 - 回复可以嵌套多层 - 家长推荐信 (适用于比特桶云): - parent_id:答复的父评论的ID - active_comment_count:未解决的评论总数(包括嵌套回复) - total_comment_count:所有评论(包括已解决和回复)的总数
- 文件变更:
- file_changes:PR中修改的所有文件的数组 - 文件路径 - 状态(添加、修改、删除或重命名) - 旧路径(用于重命名的文件) - file_changes_summary:统计摘要 - 更改的文件总数
- 还有更多。..
搜索代码
通过Bitbucket服务器的搜索索引进行索引支持的精确术语搜索(仅限Bitbucket Server)。快速-一个API调用。
// Search in a specific repository
{
"tool": "search_code",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"query": "TODO",
"limit": 50
}
}
// Filter by language and exclude noise
{
"tool": "search_code",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"query": "deprecated",
"lang": "java",
"exclude_terms": ["test", "spec"]
}
}
// Filter by extension and post-filter the result lines with a client-side regex
{
"tool": "search_code",
"arguments": {
"workspace": "PROJ",
"repository": "frontend-app",
"query": "useState",
"ext": "tsx",
"regex_filter": "^\\s*const\\s+\\[",
"case_variants": true
}
}输入
workspace(必填)--项目密钥(例如。PROJ).query(必填)--确切的术语或短语。 没有正则表达式/通配符/模糊匹配 在这一层(Bitbucket索引不支持它们)。repository--回购蛞蝓。省略搜索项目中的所有仓库。lang--比特桶lang:修饰语(例如。python,java).一个表达式涵盖了该语言的所有扩展。ext--无点扩展(例如。tsx).使用时间lang太宽泛了。path--子路径范围(Bitbucketpath:改性剂)。exclude_terms--要排除的术语数组(每个术语都变成-term).archived—true/false/*(默认:仅活动)。fork—true/false.regex_filter--客户端正则表达式作为后置过滤器应用于返回的命中行;允许您缩小结果范围,而无需花费Bitbucket查询预算。case_variants--如果为true,还将使用snakecase运行查询↔ camelBase转换并合并结果(一个额外的API调用)。limit(默认值25)和start用于分页。
需要了解的Bitbucket索引限制
- 标点符号除
.和_在索引时间被剥离。包括=,(,:在你的query并没有缩小它。 - 不区分大小写忽略单个字符术语。
- 术语之间隐含AND;支持OR/NOT/括号(运算符 全部大写).
- 硬上限:总共250个字符的查询,最多9个表达式,只有小于512 KiB的文件被索引,只有默认分支被索引。
当构造的子句超过上限时,可选子句将按优先级顺序逐一删除(exclude_terms → archived → fork → ext → lang → path → repo)以及a QUERY_TRUNCATED 发出警告。
输出(密集JSON)
{
"query": "doSomething",
"filters": { "project": "PROJ", "repo": "my-repo" },
"engine": "bitbucket_index",
"total_files": 2,
"total_matches": 3,
"files": [
{
"path": "src/lib/handler.ts",
"matches": [
{ "line": 17, "text": " const result = await doSomething(payload);" },
{ "line": 42, "text": "export function doSomething(input: Input) {" }
]
},
{
"path": "tests/handler.test.ts",
"matches": [
{ "line": 9, "text": " expect(doSomething(sample)).toEqual(expected);" }
]
}
],
"warnings": [],
"next_start": null,
"diagnostics": {
"default_branch_only": true,
"expression_count": 3,
"query_length": 42,
"dropped_clauses": []
}
}仅返回实际匹配的行(除非明确请求,否则不返回周围的上下文 regex_filter). total_files 和 total_matches 是不同的。 engine 是 bitbucket_index 为了 search_code.
需采取行动的警告
INDEX_GAP_LIKELY--Bitbucket返回零次点击,但存在匹配的文件。切换至find_in_files.如果alang:过滤器已设置,警告会特别指出它——Bitbucket可能无法识别该语言名称。REGEX_FILTER_REJECTED_ALL--Bitbucket返回了点击数,但你的regex_filter把他们都杀了。调整或放下它。PROBE_UNAVAILABLE--索引返回零,文件列表探测无法运行。无法判断该术语是否缺失或索引是否有缺口。QUERY_TRUNCATED--软降级删除了可选子句以适应Bitbucket上限;删除的条款列在diagnostics.dropped_clauses.DEPRECATED_PARAM--旧参数名称(search_query,search_context,include_patterns,file_pattern)仍然有效,但应该迁移。
在文件中查找
通过列出文件并通过Bitbucket的原始端点读取文件进行内容搜索。慢于 search_code (1+N API调用),但支持完整的regex,并适用于索引有缺口的地方(Haskell、功能分支、文件Bitbucket的索引缺失)。仅限Bitbucket服务器。
// Recover a function in files the index does not cover (e.g. an unindexed language)
{
"tool": "find_in_files",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"filename_pattern": "src/**/*.hs",
"content_query": "doSomething"
}
}
// Search a feature branch
{
"tool": "find_in_files",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch": "feat/new-thing",
"filename_pattern": "src/**/*.py",
"content_query": "^class\\s+Order"
}
}输入
workspace,repository,content_query(必填)。content_query是一个逐行应用于文件内容的JS正则表达式(PCRE风格)。filename_pattern--glob来限定文件集的范围。 强烈推荐。 如果没有它,该工具将在整个回购中扇出,并可能截断或突破利率限制。branch--默认为默认分支。regex_filter--可选的第二个正则表达式作为后置过滤器应用于每个候选命中行。max_files--获取文件的硬上限(默认值3000)。如果超过,响应包括truncated: true(在零场比赛中)aPOSSIBLE_FALSE_NEGATIVE警告。parallelism--并发文件获取(默认值4)。更高的值风险率限制;上RATE_LIMITED警告,降低此值并缩小filename_pattern.limit--最大总命中行数(默认值25)。
限速意识
find_in_files 在扇出期间监视HTTP状态代码:
- 一个
429立即中止扫描。 - 连续三次或三次以上
403s也会中止(可能是速率受限,而不是按文件权限)。 - 在两次失败之间成功读取会重置计数器。
提前中止时,响应包括 RATE_LIMITED 警告 aborted_after /总计数 diagnostics.
输出
与相同的密集JSON形状 search_code,与 engine: "find_in_files" 和 diagnostics 特定于扇出的字段:
"diagnostics": {
"files_scanned": 16,
"files_attempted": 16,
"files_failed": 0,
"files_truncated": false,
"default_branch_only": false
}备注:两者都有 search_code 和 find_in_files 仅适用于Bitbucket服务器。不计划支持Bitbucket云。
列出拉取请求
{
"tool": "list_pull_requests",
"arguments": {
"workspace": "PROJ", // Required - your project key
"repository": "my-repo",
"state": "OPEN", // Optional: OPEN, MERGED, DECLINED, ALL (default: OPEN)
"author": "username", // Optional: filter by author (see note below)
"limit": 25, // Optional: max results per page (default: 25)
"start": 0 // Optional: pagination start index (default: 0)
}
}返回一个分页的拉取请求列表,其中包含:
- 与get_pull_request具有相同详细信息的pull请求数组
- 匹配的PR总数
- 分页信息(has_more,next_start)
关于作者筛选器的说明:
- 对于Bitbucket Cloud:使用用户名(例如“johndoe”)
- 对于Bitbucket服务器:使用完整的电子邮件地址(例如,“john.doe@company.com")
创建拉取请求
{
"tool": "create_pull_request",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"title": "Add new feature",
"source_branch": "feature/new-feature",
"destination_branch": "main",
"description": "This PR adds a new feature...", // Optional
"reviewers": ["john.doe", "jane.smith"], // Optional
"close_source_branch": true // Optional (default: false)
}
}更新拉取请求
{
"tool": "update_pull_request",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"title": "Updated title", // Optional
"description": "Updated description", // Optional
"destination_branch": "develop", // Optional
"reviewers": ["new.reviewer"] // Optional - see note below
}
}关于审稿人的重要提示:
- 在未指定的情况下更新PR时
reviewers保留参数、现有审阅者及其审批状态 - 当提供
reviewers参数:
- 审阅者列表被新列表替换 - 对于PR上已经存在的审阅者,他们的审批状态将被保留 - 添加新审阅者时没有审批状态
- 这可以防止在您只想更新PR描述或标题时意外删除审阅者
添加评论
在pull请求中添加注释,可以是一般注释,也可以是特定代码的内联注释:
// General comment
{
"tool": "add_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment_text": "Great work on this PR!"
}
}
// Inline comment on specific line
{
"tool": "add_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment_text": "Consider extracting this into a separate function",
"file_path": "src/utils/helpers.js",
"line_number": 42,
"line_type": "CONTEXT" // ADDED, REMOVED, or CONTEXT
}
}
// Reply to existing comment
{
"tool": "add_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment_text": "I agree with this suggestion",
"parent_comment_id": 456
}
}
// Add comment with code suggestion (single line)
{
"tool": "add_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment_text": "This variable name could be more descriptive.",
"file_path": "src/utils/helpers.js",
"line_number": 42,
"line_type": "CONTEXT",
"suggestion": "const userAuthenticationToken = token;"
}
}
// Add comment with multi-line code suggestion
{
"tool": "add_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment_text": "This function could be simplified using array methods.",
"file_path": "src/utils/calculations.js",
"line_number": 50,
"suggestion_end_line": 55,
"line_type": "CONTEXT",
"suggestion": "function calculateTotal(items) {\n return items.reduce((sum, item) => sum + item.price, 0);\n}"
}
}建议功能使用Bitbucket可以呈现的GitHub风格的markdown建议块来格式化评论。添加建议时:
suggestion是必需的,包含替换代码file_path和line_number使用建议时需要suggestion_end_line是可选的,用于多行建议(默认为line_number)- 评论将使用“建议”标记块进行格式化,该标记块可能适用于Bitbucket UI
使用代码段而不是行号
这 add_comment 该工具现在支持使用代码片段自动查找行号。当人工智能工具分析差异并可能难以处理确切的行号时,这尤其有用:
// Add comment using code snippet
{
"tool": "add_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment_text": "This variable name could be more descriptive",
"file_path": "src/components/Button.res",
"code_snippet": "let isDisabled = false",
"search_context": {
"before": ["let onClick = () => {"],
"after": ["setLoading(true)"]
}
}
}
// Handle multiple matches with strategy
{
"tool": "add_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment_text": "Consider extracting this",
"file_path": "src/utils/helpers.js",
"code_snippet": "return result;",
"search_context": {
"before": ["const result = calculate();"],
"after": ["}"]
},
"match_strategy": "best" // Auto-select highest confidence match
}
}代码段参数:
code_snippet:要查找的确切代码行(替代line_number)search_context:用于消除多个匹配项歧义的可选上下文
- before:应出现在目标之前的线条数组 - after:应出现在目标后面的线条数组
match_strategy:如何处理多个匹配
- "strict" (默认):失败,显示所有匹配项时出错 - "best":自动选择最高置信度匹配
多个匹配的错误响应(严格模式):
{
"error": {
"code": "MULTIPLE_MATCHES_FOUND",
"message": "Code snippet 'return result;' found in 3 locations",
"occurrences": [
{
"line_number": 42,
"file_path": "src/utils/helpers.js",
"preview": " const result = calculate();\n> return result;\n}",
"confidence": 0.9,
"line_type": "ADDED"
},
// ... more matches
],
"suggestion": "To resolve, either:\n1. Add more context...\n2. Use match_strategy: 'best'...\n3. Use line_number directly"
}
}此功能特别适用于:
- AI驱动的代码审查工具,用于分析差异
- 根据代码模式自动添加注释的脚本
- 避免大差异中的行号混淆
评论回复说明:
- 使用
parent_comment_id回复任何评论(一般或内联) - 在
get_pull_request响应:
- Bitbucket服务器显示嵌套在 replies 数组 - Bitbucket Cloud展示了 parent_id 回复评论字段
- 您可以回复回复,创建嵌套对话
关于内联注释的说明:
file_path:文件的路径如diff所示line_number:差异中显示的行号line_type:
- ADDED -对于新添加的行(差异为绿色) - REMOVED -对于已删除的行(差异中为红色) - CONTEXT -对于未更改的上下文行
添加评论-完整使用指南
这 add_comment 该工具支持多种场景。以下是何时以及如何使用每种方法:
1.一般公关评论(无文件/行)
- 使用时间:对公关进行全面反馈
- 必需参数:
comment_text仅 - 示例:“LGTM!”、“请更新文档”
2.对现有评论的回复
- 使用时间:继续对话线程
- 必需参数:
comment_text,parent_comment_id - 适用于一般和内联评论回复
3.带行号的内联注释
- 使用时间:您从diff中知道确切的行号
- 必需参数:
comment_text,file_path,line_number - 可选:
line_type(默认为上下文)
4.带代码段的内联注释
- 使用时间:您有代码但没有行号(常见于AI工具)
- 必需参数:
comment_text,file_path,code_snippet - 该工具将自动找到行号
- 添加
search_context如果代码出现多次 - 使用
match_strategy: "best"当存在多个匹配项时自动选择
5.代码建议
- 使用时间:建议特定的代码更改
- 必需参数:
comment_text,file_path,line_number,suggestion - 对于多行:也添加
suggestion_end_line - 在Bitbucket UI中创建适用的建议块
人工智能/自动化工具的决策流程:
1. Do you want to suggest code changes?
→ Use suggestion with line_number
2. Do you have the exact line number?
→ Use line_number directly
3. Do you have the code snippet but not line number?
→ Use code_snippet (add search_context if needed)
4. Is it a general comment about the PR?
→ Use comment_text only
5. Are you replying to another comment?
→ Add parent_comment_id要避免的常见陷阱:
- 不要两者都用
line_number和code_snippet-挑一个 - 建议总是需要
file_path和line_number - 代码片段必须完全匹配(包括空格)
- REMOVED行引用源文件,ADDED/CONTEXT引用目标文件
合并拉取请求
{
"tool": "merge_pull_request",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"merge_strategy": "squash", // Optional: merge-commit, squash, fast-forward
"close_source_branch": true, // Optional
"commit_message": "Custom merge message" // Optional
}
}列出分支机构
{
"tool": "list_branches",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"filter": "feature", // Optional: filter by name pattern
"limit": 25, // Optional (default: 25)
"start": 0 // Optional: for pagination (default: 0)
}
}返回一个分页的分支列表,其中包含:
- 分行名称和ID
- 最新提交哈希
- 默认分支指示器
- 分页信息
删除分支
{
"tool": "delete_branch",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch_name": "feature/old-feature",
"force": false // Optional (default: false)
}
}备注:删除分支需要适当的权限。该分支将被永久删除。
获取分支
{
"tool": "get_branch",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch_name": "feature/new-feature",
"include_merged_prs": false // Optional (default: false)
}
}返回全面的分支机构信息,包括:
- 分行详细信息:
- 名称和ID - 最新提交(哈希、消息、作者、日期) - 默认分支指示器
- 打开来自此分支的拉取请求:
- PR标题和ID - 目的地分行 - 作者和审稿人 - 批准状态(已批准、已请求更改、待定) - PR网址
- 合并拉取请求(如果
include_merged_prs是真的):
- PR标题和ID - 合并日期和合并者
- 统计数据:
- 打开的PR总数 - 合并的PR总数 - 自上次提交以来的天数
此工具特别适用于:
- 删除前检查分支是否有打开的PR
- 了解分行活动概览
- 了解PR审查状态
- 识别过时的分支
列出分支机构承诺
使用高级筛选选项获取特定分支中的所有提交:
// Basic usage - get recent commits
{
"tool": "list_branch_commits",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch_name": "feature/new-feature",
"limit": 50 // Optional (default: 25)
}
}
// Filter by date range
{
"tool": "list_branch_commits",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch_name": "main",
"since": "2025-01-01T00:00:00Z", // ISO date string
"until": "2025-01-15T23:59:59Z" // ISO date string
}
}
// Filter by author
{
"tool": "list_branch_commits",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch_name": "develop",
"author": "john.doe@company.com", // Email or username
"limit": 100
}
}
// Exclude merge commits
{
"tool": "list_branch_commits",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch_name": "release/v2.0",
"include_merge_commits": false
}
}
// Search in commit messages
{
"tool": "list_branch_commits",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch_name": "main",
"search": "bugfix", // Search in commit messages
"limit": 50
}
}
// Combine multiple filters
{
"tool": "list_branch_commits",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch_name": "develop",
"author": "jane.smith@company.com",
"since": "2025-01-01T00:00:00Z",
"include_merge_commits": false,
"search": "feature",
"limit": 100,
"start": 0 // For pagination
}
}
// Include CI/CD build status (Bitbucket Server only)
{
"tool": "list_branch_commits",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"branch_name": "main",
"include_build_status": true, // Fetch build status for each commit
"limit": 50
}
}过滤器参数:
since:ISO日期字符串-仅显示此日期之后的提交until:ISO日期字符串-仅显示此日期之前的提交author:按作者电子邮件/用户名筛选include_merge_commits:用于包含/排除合并提交的布尔值(默认值:true)search:在提交消息中搜索文本include_build_status:布尔值,包括CI/CD构建状态(默认值:false,仅限Bitbucket服务器)
返回详细的提交信息:
{
"branch_name": "feature/new-feature",
"branch_head": "abc123def456", // Latest commit hash
"commits": [
{
"hash": "abc123def456",
"abbreviated_hash": "abc123d",
"message": "Add new feature implementation",
"author": {
"name": "John Doe",
"email": "john.doe@example.com"
},
"date": "2025-01-03T10:30:00Z",
"parents": ["parent1hash", "parent2hash"],
"is_merge_commit": false,
"build_status": { // Only present when include_build_status is true
"successful": 5,
"failed": 0,
"in_progress": 1,
"unknown": 0
}
}
// ... more commits
],
"total_count": 150,
"start": 0,
"limit": 25,
"has_more": true,
"next_start": 25,
"filters_applied": {
"author": "john.doe@example.com",
"since": "2025-01-01",
"include_merge_commits": false,
"include_build_status": true
}
}此工具特别适用于:
- 发布前查看提交历史记录
- 查找特定作者的提交
- 跟踪日期范围内的更改
- 搜索特定功能或修复
- 分析分支活动模式
- 监控提交的CI/CD构建状态(仅限Bitbucket服务器)
列出公关承诺
获取拉取请求中的所有提交:
// Basic usage
{
"tool": "list_pr_commits",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"limit": 50, // Optional (default: 25)
"start": 0 // Optional: for pagination
}
}
// Include CI/CD build status (Bitbucket Server only)
{
"tool": "list_pr_commits",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"include_build_status": true, // Fetch build status for each commit
"limit": 50
}
}返回PR的提交信息:
{
"pull_request_id": 123,
"pull_request_title": "Add awesome feature",
"commits": [
{
"hash": "def456ghi789",
"abbreviated_hash": "def456g",
"message": "Initial implementation",
"author": {
"name": "Jane Smith",
"email": "jane.smith@example.com"
},
"date": "2025-01-02T14:20:00Z",
"parents": ["parent1hash"],
"is_merge_commit": false,
"build_status": { // Only present when include_build_status is true
"successful": 3,
"failed": 0,
"in_progress": 0,
"unknown": 0
}
}
// ... more commits
],
"total_count": 5,
"start": 0,
"limit": 25,
"has_more": false
}此工具特别适用于:
- 合并前审查PR中的所有更改
- 了解公关的发展历史
- 检查提交消息的质量
- 验证更改的作者身份
- 按提交次数分析PR复杂性
- 监控所有PR提交的CI/CD构建状态(仅限Bitbucket服务器)
获取提交详细信息
使用结构化的逐行信息获取SHA特定提交的差异。返回包含单独行的大块文件,每个行都有行号和ADDED/REMOVED/CONTEXT类型信息。
// Basic usage - get full commit diff
{
"tool": "get_commit_detail",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"commit_id": "abc123def456",
"context_lines": 5 // Optional (default: 3)
}
}
// Get diff for a specific file only
{
"tool": "get_commit_detail",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"commit_id": "abc123def456",
"file_path": "src/index.ts"
}
}
// Exclude generated/lock files
{
"tool": "get_commit_detail",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"commit_id": "abc123def456",
"exclude_patterns": ["*.lock", "*.svg", "node_modules/**"]
}
}
// Include only specific file types
{
"tool": "get_commit_detail",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"commit_id": "abc123def456",
"include_patterns": ["*.ts", "src/**/*.js"]
}
}结构化响应格式(Bitbucket服务器):
{
"commit_id": "abc123def456",
"files": [
{
"file_path": "src/index.ts",
"old_path": null,
"status": "modified",
"hunks": [
{
"context": "export function foo() {",
"source_start": 10,
"source_span": 5,
"destination_start": 10,
"destination_span": 6,
"lines": [
{
"source_line": 10,
"destination_line": 10,
"type": "CONTEXT",
"content": " const x = 1;"
},
{
"source_line": 11,
"destination_line": 11,
"type": "REMOVED",
"content": " return x;"
},
{
"source_line": 11,
"destination_line": 11,
"type": "ADDED",
"content": " return x + 1;"
}
]
}
]
}
],
"summary": {
"total_files": 3,
"files_included": 1,
"files_excluded": 2
},
"filter_metadata": {
"filters_applied": {
"file_path": "src/index.ts"
}
}
}此工具特别适用于:
- 准确回顾特定提交中发生了什么变化
- 在提交到分支机构之前或之后对其进行审计
- 获取结构化差异数据以进行自动化分析
获取拉取请求差异
使用结构化的逐行信息获取拉取请求的差异/更改。返回包含单独行的大块文件,每个行都有行号和类型信息,便于内联注释。
// Get full diff (default behavior)
{
"tool": "get_pull_request_diff",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"context_lines": 5 // Optional (default: 3)
}
}
// Exclude specific file types
{
"tool": "get_pull_request_diff",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"exclude_patterns": ["*.lock", "*.svg", "node_modules/**", "*.min.js"]
}
}
// Include only specific file types
{
"tool": "get_pull_request_diff",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"include_patterns": ["*.res", "*.resi", "src/**/*.js"]
}
}
// Get diff for a specific file only
{
"tool": "get_pull_request_diff",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"file_path": "src/components/Button.res"
}
}
// Combine filters
{
"tool": "get_pull_request_diff",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"include_patterns": ["src/**/*"],
"exclude_patterns": ["*.test.js", "*.spec.js"]
}
}筛选选项:
include_patterns:要包含的glob模式数组(白名单)exclude_patterns:要排除的glob模式数组(黑名单)file_path:仅获取特定文件的差异- 模式支持标准glob语法(例如。,
*.js,src/**/*.res,!test/**)
结构化响应格式(Bitbucket服务器):
响应包括带行号的结构化逐行信息,使AI工具可以轻松添加内联注释:
{
"message": "Pull request diff retrieved successfully",
"pull_request_id": 123,
"from_hash": "abc123...",
"to_hash": "def456...",
"files": [
{
"file_path": "src/components/Button.res",
"old_path": null,
"status": "modified",
"hunks": [
{
"context": "let make = () => {",
"source_start": 27,
"source_span": 6,
"destination_start": 27,
"destination_span": 7,
"lines": [
{
"source_line": 27,
"destination_line": 27,
"type": "CONTEXT",
"content": " let onClick = () => {"
},
{
"source_line": 28,
"destination_line": 28,
"type": "CONTEXT",
"content": " setLoading(true)"
},
{
"source_line": 29,
"destination_line": 29,
"type": "REMOVED",
"content": " oldFunction()"
},
{
"source_line": 29,
"destination_line": 29,
"type": "ADDED",
"content": " newFunction()"
},
{
"source_line": 30,
"destination_line": 30,
"type": "CONTEXT",
"content": " }"
}
]
}
]
}
],
"summary": {
"total_files": 15,
"files_included": 1,
"files_excluded": 14
},
"filter_metadata": {
"filters_applied": {
"file_path": "src/components/Button.res"
},
"excluded_file_list": ["package-lock.json", "logo.svg"]
}
}线路类型和使用 add_comment:
| 线条类型 | 描述 | 与一起使用 add_comment |
|---|---|---|
ADDED | 新行(差异为绿色) | 使用 destination_line 作为 line_number, line_type: "ADDED" |
REMOVED | 删除行(差异中为红色) | 使用 source_line 作为 line_number, line_type: "REMOVED" |
CONTEXT | 未更改的上下文行 | 使用 destination_line 作为 line_number, line_type: "CONTEXT" |
示例:在ADDED行上添加内联注释:
// From the diff response, we see line 29 was added with content " newFunction()"
{
"tool": "add_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"file_path": "src/components/Button.res",
"line_number": 29, // Use destination_line for ADDED
"line_type": "ADDED",
"comment_text": "Consider adding error handling here"
}
}注: Bitbucket Cloud当前返回原始diff格式。结构化格式仅适用于Bitbucket服务器。
批准拉取请求
{
"tool": "approve_pull_request",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123
}
}请求更改
{
"tool": "request_changes",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment": "Please address the following issues..." // Optional
}
}列出目录内容
{
"tool": "list_directory_content",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"path": "src/components", // Optional (defaults to root)
"branch": "main" // Optional (defaults to default branch)
}
}返回目录列表,其中包含:
- 路径和分支信息
- 包含以下内容的数组:
- 名称 - 类型(文件或目录) - 文件大小 - 完整路径
- 项目总数
搜索文件
在存储库中按名称或路径模式搜索文件。使用不区分大小写匹配的glob模式(如VS Code的Ctrl+P文件搜索)。
// Search for all TypeScript files
{
"tool": "search_files",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pattern": "*.ts"
}
}
// Search for files containing "Controller" in the name
{
"tool": "search_files",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pattern": "**/Controller*"
}
}
// Search within a specific directory
{
"tool": "search_files",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pattern": "*.res",
"path": "src/components"
}
}
// Search on a specific branch with result limit
{
"tool": "search_files",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pattern": "**/*Config*",
"branch": "develop",
"limit": 50
}
}
// Case-insensitive search (matches SomeComponent.res, Somefile.res, etc.)
{
"tool": "search_files",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pattern": "**/someFile*"
}
}参数:
workspace:项目密钥(必填)repository:存储库段塞(必填)pattern:Glob模式用于过滤文件(可选,如果未指定,则返回所有文件)
- 支持标准glob语法: *.ts, **/*.java, **/Controller* - 不区分大小写的匹配
path:要在其中搜索的子目录(可选,默认为根目录)branch:分支名称(可选,默认为默认分支)limit:要返回的最大匹配文件数(可选,默认值:100)
答复:
{
"workspace": "PROJ",
"repository": "my-repo",
"branch": "master",
"search_path": "/",
"pattern": "*.res",
"files": [
"src/App.res",
"src/components/Button.res",
"src/utils/DateUtils.res"
],
"total_files_scanned": 5000,
"total_matched": 150,
"returned": 100,
"truncated": true
}此工具特别适用于:
- 按名称模式查找文件(如VS Code的Ctrl+P)
- 在存储库中查找特定类型的所有文件
- 查找配置文件或特定组件
- 探索不熟悉的代码库
获取文件内容
{
"tool": "get_file_content",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"file_path": "src/index.ts",
"branch": "main", // Optional (defaults to default branch)
"start_line": 1, // Optional: starting line (1-based, use negative for from end)
"line_count": 100, // Optional: number of lines to return
"full_content": false // Optional: force full content (default: false)
}
}智能截断功能:
- 自动截断大文件(>50KB)以防止令牌过载
- 基于文件类型的默认行数:
- 配置文件(.yml、.json):200行 - 文档(.md、.txt):300行 - 代码文件(.ts、.js、.py):500行 - 日志文件:最后100行
- 使用
start_line: -50获取最后50行(尾部功能) - 大于1MB的文件需要显式
full_content: true或线路参数
返回包含以下内容的文件内容:
- 文件路径和分支
- 文件大小和编码
- 内容(根据参数完整或截断)
- 行信息(如果截断):
- 文件中的总行数 - 返回线路范围 - 截断指示器
- 最后修改的信息(提交、作者、日期)
示例响应:
// Small file - returns full content
{
"file_path": "package.json",
"branch": "main",
"size": 1234,
"encoding": "utf-8",
"content": "{\n \"name\": \"my-project\",\n ...",
"last_modified": {
"commit_id": "abc123",
"author": "John Doe",
"date": "2025-01-21T10:00:00Z"
}
}
// Large file - automatically truncated
{
"file_path": "src/components/LargeComponent.tsx",
"branch": "main",
"size": 125000,
"encoding": "utf-8",
"content": "... first 500 lines ...",
"line_info": {
"total_lines": 3500,
"returned_lines": {
"start": 1,
"end": 500
},
"truncated": true,
"message": "Showing lines 1-500 of 3500. File size: 122.1KB"
}
}追究文件责任
获取文件的每行作者身份(责备)——谁最后修改了每一行、提交哈希和作者时间戳。喂养返回的 commit_id 进入 get_commit_detail 看看到底发生了什么变化。
仅限Bitbucket服务器。 Bitbucket Cloud不公开指责API。
// Full-file blame
{
"tool": "get_file_blame",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"file_path": "src/index.ts"
}
}
// Blame for a specific branch and line range
{
"tool": "get_file_blame",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"file_path": "src/index.ts",
"branch": "main",
"start_line": 100,
"line_count": 20
}
}
// Ungrouped — one entry per line
{
"tool": "get_file_blame",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"file_path": "src/index.ts",
"group_by_commit": false
}
}参数:
file_path:文件路径,例如。"src/index.ts"(必填)branch:分支名称(可选,默认为默认分支)start_line:起始行(从1开始)限制输出(可选)line_count:要返回的行数start_line(可选)group_by_commit:将同一提交中的连续行分组到范围中(默认值:true)
响应(分组,默认):
{
"file_path": "src/index.ts",
"branch": "main",
"total_lines": 1982,
"returned_lines": { "start": 1, "end": 1982 },
"unique_commits": 42,
"unique_authors": 16,
"grouped": true,
"blame": [
{
"line_start": 1,
"line_end": 4,
"commit_id": "fbbe61e95f51abb8aed8dd5a472074a77b3d0f46",
"commit_display_id": "fbbe61e95f5",
"author": { "name": "Jane Doe", "email": "jane@example.com" },
"date": "2025-04-15T12:01:01.000Z",
"original_file_name": "src/index.ts"
}
]
}响应(未分组, group_by_commit: false): 每个 blame 条目只有一个 line 字段而不是 line_start/line_end.
适用于:
- 在请求审阅之前查找文件的主要作者
- 追踪谁引入了特定的行或块
- 喂养
commit_id进入get_commit_detail看到被指责的变化的全部差异 - 重构共享模块时识别代码所有权
列出项目
列出所有可访问的Bitbucket项目(服务器)或工作区(云):
// List all accessible projects
{
"tool": "list_projects",
"arguments": {
"limit": 25, // Optional (default: 25)
"start": 0 // Optional: for pagination (default: 0)
}
}
// Filter by project name
{
"tool": "list_projects",
"arguments": {
"name": "backend", // Partial name match
"limit": 50
}
}
// Filter by permission level (Bitbucket Server only)
{
"tool": "list_projects",
"arguments": {
"permission": "PROJECT_WRITE", // PROJECT_READ, PROJECT_WRITE, PROJECT_ADMIN
"limit": 100
}
}参数:
name:按项目/工作区名称筛选(部分匹配,可选)permission:按权限级别筛选(仅限Bitbucket服务器,可选)
- PROJECT_READ:读取权限 - PROJECT_WRITE:写入权限 - PROJECT_ADMIN:管理员访问权限
limit:要返回的最大项目数(默认值:25)start:开始分页索引(默认值:0)
返回项目/工作区信息:
{
"projects": [
{
"key": "PROJ",
"id": 1234,
"name": "My Project",
"description": "Project description",
"is_public": false,
"type": "NORMAL", // NORMAL or PERSONAL (Server), WORKSPACE (Cloud)
"url": "https://bitbucket.yourcompany.com/projects/PROJ"
}
// ... more projects
],
"total_count": 15,
"start": 0,
"limit": 25,
"has_more": false,
"next_start": null
}备注:
- 对于Bitbucket Cloud,这将返回工作区(而不是传统意义上的项目)
- 对于Bitbucket Server,这将返回个人和团队项目
此工具特别适用于:
- 发现您帐户的可用项目/工作区
- 正在查找其他API调用所需的项目密钥
- 识别您具有特定权限的项目
- 浏览组织结构
列出存储库
列出特定项目/工作区内或所有可访问存储库中的存储库:
// List all repositories in a workspace/project
{
"tool": "list_repositories",
"arguments": {
"workspace": "PROJ", // Required for Bitbucket Cloud, optional for Server
"limit": 25, // Optional (default: 25)
"start": 0 // Optional: for pagination (default: 0)
}
}
// List all accessible repositories (Bitbucket Server only)
{
"tool": "list_repositories",
"arguments": {
"limit": 100
}
}
// Filter by repository name
{
"tool": "list_repositories",
"arguments": {
"workspace": "PROJ",
"name": "frontend", // Partial name match
"limit": 50
}
}
// Filter by permission level (Bitbucket Server only)
{
"tool": "list_repositories",
"arguments": {
"workspace": "PROJ",
"permission": "REPO_WRITE", // REPO_READ, REPO_WRITE, REPO_ADMIN
"limit": 100
}
}参数:
workspace:项目密钥(服务器)或工作区段块(云)
- Bitbucket云需要 - Bitbucket服务器可选(省略列出所有可访问的存储库)
name:按存储库名称筛选(部分匹配,可选)permission:按权限级别筛选(仅限Bitbucket服务器,可选)
- REPO_READ:读取权限 - REPO_WRITE:写入权限 - REPO_ADMIN:管理员访问权限
limit:要返回的最大存储库数(默认值:25)start:开始分页索引(默认值:0)
返回存储库信息:
{
"repositories": [
{
"slug": "my-repo",
"id": 5678,
"name": "My Repository",
"description": "Repository description",
"project_key": "PROJ",
"project_name": "My Project",
"state": "AVAILABLE", // AVAILABLE, INITIALISING, INITIALISATION_FAILED (Server)
"is_public": false,
"is_forkable": true,
"clone_urls": {
"http": "https://bitbucket.yourcompany.com/scm/PROJ/my-repo.git",
"ssh": "ssh://git@bitbucket.yourcompany.com:7999/PROJ/my-repo.git"
},
"url": "https://bitbucket.yourcompany.com/projects/PROJ/repos/my-repo"
}
// ... more repositories
],
"total_count": 42,
"start": 0,
"limit": 25,
"has_more": true,
"next_start": 25,
"workspace": "PROJ"
}重要提示:
- 比特桶云 要求
workspace参数。如果省略,您将收到一条错误消息 - 比特桶服务器 允许通过省略以下内容列出所有可访问的存储库
workspace参数 - 为HTTP(S)和SSH协议都提供了克隆URL
此工具特别适用于:
- 在项目/工作区中发现可用的存储库
- 查找其他API调用所需的存储库阻塞
- 识别您具有特定权限的存储库
- 获取存储库的克隆URL
- 浏览组织内的存储库结构
搜索存储库
按名称或描述搜索存储库(仅限Bitbucket服务器):
// Basic search
{
"tool": "search_repositories",
"arguments": {
"search_query": "backend",
"limit": 10
}
}
// Search within a specific project
{
"tool": "search_repositories",
"arguments": {
"search_query": "dashboard",
"workspace": "PROJ",
"limit": 25
}
}返回带有项目关联的存储库搜索结果。
拒绝拉取请求
拒绝/拒绝拉取请求:
{
"tool": "decline_pull_request",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment": "Closing this PR as the feature is no longer needed" // Optional
}
}删除评论
从pull请求中删除注释:
{
"tool": "delete_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment_id": 456
}
}备注:带有回复的评论不能删除。只有评论作者、PR作者或存储库管理员可以删除评论。
PR任务管理(仅限Bitbucket服务器)
任务是可以添加到拉取请求中的清单项。它们有助于跟踪合并前需要完成的操作项。
列出公关任务
{
"tool": "list_pr_tasks",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123
}
}返回所有任务及其状态:
{
"pull_request_id": 123,
"tasks": [
{
"id": 456,
"text": "Update documentation",
"author": "John Doe",
"state": "OPEN",
"created_on": "2025-01-25T10:00:00Z",
"is_resolved": false
}
],
"summary": {
"total": 3,
"open": 2,
"resolved": 1
}
}创建PR任务
{
"tool": "create_pr_task",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"text": "Add unit tests for the new feature"
}
}更新PR任务
{
"tool": "update_pr_task",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"task_id": 456,
"text": "Add unit tests and integration tests"
}
}将任务标记为已完成/取消标记
// Mark as done
{
"tool": "mark_pr_task_done",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"task_id": 456
}
}
// Reopen task
{
"tool": "unmark_pr_task_done",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"task_id": 456
}
}删除PR任务
{
"tool": "delete_pr_task",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"task_id": 456
}
}在评论和任务之间转换
// Convert a comment to a task
{
"tool": "convert_comment_to_task",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"comment_id": 456
}
}
// Convert a task back to a comment
{
"tool": "convert_task_to_comment",
"arguments": {
"workspace": "PROJ",
"repository": "my-repo",
"pull_request_id": 123,
"task_id": 456
}
}任务说明:
- 任务以注释的形式执行
severity: "BLOCKER"在Bitbucket服务器中 - 任务可以在
OPEN或RESOLVED状态 - 只有任务创建者、PR作者或存储库管理员可以编辑文本或删除任务
- 任何具有读取权限的人都可以将任务标记为已完成/未完成
发展
npm run dev-开发观看模式npm run build-构建TypeScript代码npm start-运行内置服务器
故障排除
- 身份验证错误:仔细检查您的用户名和应用程序密码
- 404错误:验证工作区、存储库段块和PR ID
- 权限错误:确保您的应用程序密码具有所需的权限
许可证
麻省理工学院
