Skip to content

Expose team_reviewers in add_reviewer MCP tool schema#29229

Merged
pelikhan merged 2 commits intomainfrom
copilot/allow-team-reviewers-in-add-reviewer
Apr 30, 2026
Merged

Expose team_reviewers in add_reviewer MCP tool schema#29229
pelikhan merged 2 commits intomainfrom
copilot/allow-team-reviewers-in-add-reviewer

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

The add_reviewer tool handler and Go config generation already supported team reviewers end-to-end, but the MCP tool schema only exposed reviewers (user logins). Agents passing team slugs through reviewers would get a silent 201 with no team assigned.

Changes

  • actions/setup/js/safe_outputs_tools.json — adds team_reviewers array property; replaces required: ["reviewers"] with anyOf requiring at least one of reviewers or team_reviewers; aligns pull_request_number description with the more informative version already in the embedded schema
  • pkg/workflow/js/safe_outputs_tools.json — updates tool description to mention team reviewer support (schema was already correct in this file)
  • actions/setup/js/types/safe-outputs.d.ts — adds team_reviewers?: string[] to AddReviewerItem; makes reviewers optional to match the anyOf constraint

Example

{"type":"add_reviewer","team_reviewers":["platform-team","security-reviewers"]}
{"type":"add_reviewer","reviewers":["octocat"],"team_reviewers":["platform-team"]}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw on_test.go (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw go lidation_test.go/home/REDACTED/work/gh-aw/gh-aw/.github/workflows x_amd64/vet vali�� *.json' '!../../remote.origin.url validation_test.go 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv ./../pkg/workflo-errorsas --local git http.https://gitbash (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv se 7677065/b024/vet.cfg ock.yml (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv 7677065/b075/_pkremote.origin.url pkg/workflow/compiled_lock_files_test.go yml pkg/workflow/cominfocmp /testdeps pkg/workflow/comxterm-color ache/go/1.25.8/x64/pkg/tool/linushow (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv ./../pkg/workflo-errorsas --local k/gh-aw/gh-aw/.g-nilfunc (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv se 7677065/b021/vetowner=github .cfg (http block)
  • https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv get --local $name) { hasDiscussionsEnabled } } core.hooksPath (http block)
    • Triggering command: /usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq [.object.sha, .object.type] | @tsv get --local x_amd64/vet core.hooksPath (http block)
  • https://api.github.com/repos/github/gh-aw
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw --jq .default_branch npx prettier --wremote.origin.url (http block)

If you need me to access, download, or install something from one of these locations, you can either:

… types

- Add `team_reviewers` property to `add_reviewer` inputSchema in both
  `actions/setup/js/safe_outputs_tools.json` and `pkg/workflow/js/safe_outputs_tools.json`
- Replace `required: ['reviewers']` with `anyOf` requiring at least one of
  `reviewers` or `team_reviewers` in `actions/setup/js/safe_outputs_tools.json`
- Update tool description to mention team reviewer support
- Add `team_reviewers` optional field to `AddReviewerItem` TypeScript interface
  and make `reviewers` optional (consistent with anyOf constraint)
- Update `pull_request_number` description in actions/setup/js to be more informative

The Go handler config generation and runtime JavaScript handler already supported
team_reviewers - this change exposes the feature through the MCP tool schema
so AI agents can use it.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/a993684c-b06c-43a0-bdc0-0483e73e2564

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for setting team_reviewers in add_reviewer tool Expose team_reviewers in add_reviewer MCP tool schema Apr 30, 2026
Copilot AI requested a review from pelikhan April 30, 2026 01:28
@pelikhan pelikhan marked this pull request as ready for review April 30, 2026 01:29
Copilot AI review requested due to automatic review settings April 30, 2026 01:29
@pelikhan pelikhan merged commit 7e0725c into main Apr 30, 2026
26 checks passed
@pelikhan pelikhan deleted the copilot/allow-team-reviewers-in-add-reviewer branch April 30, 2026 01:29
@github-actions
Copy link
Copy Markdown
Contributor

Hey @Copilot 👋 — nice focused change adding team_reviewers support to the add_reviewer tool! The schema update, anyOf validation, TypeScript interface, and description sync across both JSON files are all clean and consistent.

One thing to address before this is ready:

  • No tests — the diff doesn't include any test file changes. Given that reviewers was previously required and is now optional (with anyOf), a unit test covering the new team_reviewers-only path (and the combined path) would help guard against regressions.

If you'd like a hand adding coverage, assign this prompt to your coding agent:

Add unit tests for the `add_reviewer` tool's updated schema in this repository.
Cover the following scenarios:
1. Providing only `reviewers` — should be valid.
2. Providing only `team_reviewers` — should be valid.
3. Providing both `reviewers` and `team_reviewers` — should be valid.
4. Providing neither — should be invalid (fails anyOf validation).
Look at existing tests for `add_reviewer` or safe-outputs tooling to find the right test file and pattern to follow.

Generated by Contribution Check · ● 1.5M ·

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Exposes team_reviewers in the add_reviewer MCP tool schema so agents can add team reviewers explicitly (instead of incorrectly passing team slugs via reviewers).

Changes:

  • Updated the add_reviewer JSON schema to accept team_reviewers and to require at least one of reviewers/team_reviewers via anyOf.
  • Updated the tool description to mention team reviewer support.
  • Updated TypeScript typings to add team_reviewers?: string[] and make reviewers optional.
Show a summary per file
File Description
actions/setup/js/safe_outputs_tools.json Adds team_reviewers, replaces required with anyOf, and updates parameter/tool descriptions.
pkg/workflow/js/safe_outputs_tools.json Updates the add_reviewer tool description to mention team reviewers.
actions/setup/js/types/safe-outputs.d.ts Adds team_reviewers typing and makes reviewers optional to align with schema intent.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/3 changed files
  • Comments generated: 1

Comment on lines 550 to 553
"inputSchema": {
"type": "object",
"required": ["reviewers"],
"anyOf": [{ "required": ["reviewers"] }, { "required": ["team_reviewers"] }],
"properties": {
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema now uses anyOf to require at least one of reviewers or team_reviewers, but the MCP server-side argument validation only checks inputSchema.required (see actions/setup/js/mcp_scripts_validation.cjs:15-27). With no required array, calls that omit both fields won’t be rejected early and won’t get an enhanced “missing args” error. Consider either extending validateRequiredFields (and enhanced error generation) to understand this anyOf pattern, or keeping a required-based constraint that the server can actually enforce.

See below for a potential fix:

    "description": "Add reviewers (users or teams) to a GitHub pull request. Reviewers receive notifications and can approve or request changes. Use 'copilot' as a reviewer name to request the Copilot PR review bot. Provide `reviewers` for user reviewers; include `team_reviewers` for team reviewers. To request only team reviewers, pass `reviewers: []` so current server-side required-argument validation succeeds.",
    "inputSchema": {
      "type": "object",
      "required": ["reviewers"],
      "properties": {
        "reviewers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "GitHub usernames to add as reviewers (e.g., ['octocat', 'copilot']). Users must have access to the repository. This field is required by current server-side validation; if you are only adding team reviewers, pass an empty array here."
        },
        "team_reviewers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "GitHub team slugs to add as team reviewers (e.g., ['platform-team', 'security-reviewers']). Teams must have access to the repository. If you only want team reviewers, also pass `reviewers: []`."

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow for setting team_reviewers on add_reviewer tool call

3 participants