跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

manage-pull-requests

Manage Harness Code pull requests via MCP. List, create, update, and merge PRs; add reviewers and submit review decisions (approve / request changes); post, update, and delete comments; read the discussion timeline; and check CI status. Use when asked to open a PR, merge a PR, approve a PR, leave a code review comment, request changes, assign reviewers, or inspect PR checks and activity. Trigger phrases: pull request, PR review, merge PR, approve PR, request changes, add reviewer, PR comments, PR checks, PR activity, code review.

Harness · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add harness/harness-skills --skill manage-pull-requests

技能说明


name: manage-pull-requests description: >- Manage Harness Code pull requests via MCP. List, create, update, and merge PRs; add reviewers and submit review decisions (approve / request changes); post, update, and delete comments; read the discussion timeline; and check CI status. Use when asked to open a PR, merge a PR, approve a PR, leave a code review comment, request changes, assign reviewers, or inspect PR checks and activity. Trigger phrases: pull request, PR review, merge PR, approve PR, request changes, add reviewer, PR comments, PR checks, PR activity, code review. metadata: author: Harness version: 1.0.0 mcp-server: harness-mcp-v2 license: Apache-2.0 compatibility: Requires Harness MCP server (harness-mcp-v2)

Manage Pull Requests

Manage Harness Code pull requests, reviewers, comments, checks, and activity via MCP.

MCP Tools Used

ToolResource TypePurpose
harness_listpull_requestList PRs in a repo, filter by state
harness_getpull_requestGet PR details by number
harness_createpull_requestOpen a new PR
harness_updatepull_requestUpdate PR title / description / state
harness_execute (action: merge)pull_requestMerge a PR (merge/squash/rebase/fast-forward)
harness_listpr_reviewerList reviewers on a PR
harness_createpr_reviewerAdd a reviewer to a PR
harness_execute (action: submit_review)pr_reviewerSubmit an approved or changereq review
harness_createpr_commentPost a top-level or inline code comment
harness_updatepr_commentEdit a comment
harness_deletepr_commentDelete a comment
harness_listpr_activityRead the discussion timeline — the only way to READ comments
harness_listpr_checkList CI status checks on a PR
harness_schemaany of the aboveExact JSON Schema for create / update body fields

All pull-request resources are repo-scoped. Every call needs repo_id and pr_number (except harness_list for pull_request, which only needs repo_id). org_id / project_id are optional (the server infers them from the repo).

URL shortcut: the MCP server auto-extracts repo_id and pr_number if you pass a Harness PR URL via the url parameter — e.g. harness_get(resource_type="pull_request", url="https://app.harness.io/ng/account/.../pulls/42").

Instructions

Step 1: List or find the PR

Call MCP tool: harness_list
Parameters:
  resource_type: "pull_request"
  repo_id: "<repository_identifier>"
  state: "open"        # optional: open | closed | merged
  query: "<keyword>"   # optional: full-text search

Or fetch a specific PR:

Call MCP tool: harness_get
Parameters:
  resource_type: "pull_request"
  repo_id: "<repository_identifier>"
  pr_number: <number>

Step 2: Open a PR

Call MCP tool: harness_create
Parameters:
  resource_type: "pull_request"
  repo_id: "<repository_identifier>"
  body:
    title: "Fix race condition in scheduler"
    source_branch: "fix/scheduler-race"
    target_branch: "main"
    description: "Resolves HAR-1234. Adds mutex around queue access."

title, source_branch, target_branch are required. description supports markdown.

Step 3: Update PR metadata

Call MCP tool: harness_update
Parameters:
  resource_type: "pull_request"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    title: "Updated title"
    description: "Updated description"
    state: "closed"     # optional: open | closed

All body fields are optional — only include what you want to change.

Step 4: Add reviewers

Call MCP tool: harness_create
Parameters:
  resource_type: "pr_reviewer"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    reviewer_id: <numeric_user_id>

List current reviewers with harness_list(resource_type="pr_reviewer", repo_id, pr_number).

Step 5: Submit a review decision

Call MCP tool: harness_execute
Parameters:
  resource_type: "pr_reviewer"
  action: "submit_review"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    decision: "approved"          # approved | changereq
    commit_sha: "<sha>"           # optional — the commit you reviewed

Step 6: Post a comment

Top-level comment:

Call MCP tool: harness_create
Parameters:
  resource_type: "pr_comment"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    text: "LGTM with one nit — see inline."

Inline code comment:

Call MCP tool: harness_create
Parameters:
  resource_type: "pr_comment"
  repo_id: "<repo>"
  pr_number: <number>
  body:
    text: "This loop can leak if the context is cancelled."
    path: "scheduler/queue.go"
    line_new: 142
    source_commit_sha: "<source_sha>"
    target_commit_sha: "<target_sha>"

Use line_old for comments on removed lines.

Step 7: Read comments — use pr_activity, not pr_comment

The Harness Code API does not expose GET on /comments. To read the discussion, list PR activity filtered by kind:

Call MCP tool: harness_list
Parameters:
  resource_type: "pr_activity"
  repo_id: "<repo>"
  pr_number: <number>
  kind: "comment"        # just comments (general + code)
  # or type: "code-comment" for inline code review comments only

Other useful type filters: review-submit, reviewer-add, state-change, merge, title-change.

Step 8: Edit or delete a comment

Call MCP tool: harness_update
Parameters:
  resource_type: "pr_comment"
  repo_id: "<repo>"
  pr_number: <number>
  comment_id: <numeric_comment_id>
  body:
    text: "Updated comment body"
Call MCP tool: harness_delete
Parameters:
  resource_type: "pr_comment"
  repo_id: "<repo>"
  pr_number: <number>
  comment_id: <numeric_comment_id>

Step 9: Inspect CI checks

Call MCP tool: harness_list
Parameters:
  resource_type: "pr_check"
  repo_id: "<repo>"
  pr_number: <number
阅读完整来源 ↗