Assign an organization role to a team
Use assign_team_role to grant an existing organization role to an
existing team. This is a write that mutates permissions across every repo
the role’s definition covers — read
the confirm-echo contract
before your first call if you haven’t used one of this plugin’s write tools
before.
Prerequisites
Section titled “Prerequisites”github-org-identityinstalled.- A GitHub token resolvable via
GITHUB_TOKENorgh auth token, with the org’sadmin:orgscope or App-installationmembers/organization_administrationpermission. This is a mutation — the identity needs write access to organization-roles, not just read. - The numeric
roleId(from list_organization_roles) and the target team’sslug(not its display name). - This tool only assigns a role to a team that already exists. It does not create teams.
-
Ask for the tool, passing the role id twice — once as
roleId, once asconfirmRoleId— plus the team’s slug:Use
assign_team_rolefor orgmy-org, roleId8132, confirmRoleId8132, teamSlugmy-team.The two role-id fields must be identical. If they aren’t, the call throws
confirmation_mismatchbefore any GitHub API request is made — this is a deliberate guard, not a bug; retry with matching values once you’ve confirmed theroleIdyou meant to use. -
On success you get back
{ "org": "my-org", "roleId": 8132, "teamSlug": "my-team" }. -
Confirm the assignment took effect with list_role_teams — the team should now appear in that role’s team list.
If the call fails
Section titled “If the call fails”confirmation_mismatch—roleIdandconfirmRoleIddidn’t match; no API call was made. Retry with the same value in both fields.missing_scope— no resolvable token.github_api_error— theroleIdorteamSlugdoesn’t exist, or the identity lacks org-roles write access.
Remove the role again if you were experimenting, or assign the same role to a user.