List an org's organization roles
Use list_organization_roles to see every predefined and custom
organization role an org has defined, before looking up who holds any of
them.
Prerequisites
Section titled “Prerequisites”github-org-identityinstalled.- A GitHub token (
GITHUB_TOKENenv var, orgh auth tokenfallback) whose identity holds the org’sadmin:orgscope (classic PAT) or an App-installation token with the org-levelmembers/organization_administrationpermission. This is a read call, but the organization-roles endpoint requires the same scope for reads as writes.
-
Ask for the tool with the org’s login:
Use
list_organization_rolesfor orgmy-org. -
Read the result — an array of:
{ "id": 8132, "name": "all_repo_read", "description": "View all repositories", "source": "Predefined", "baseRole": null }sourcedistinguishes GitHub’s predefined roles from ones the org defined itself (Organization).baseRoleis set only when a custom role was built on top of a predefined base. -
Note the
idof any role you want to inspect further — it’s theroleIdevery other tool in this plugin takes, not the role’sname.
If the call fails
Section titled “If the call fails”missing_scope— no resolvable token. SetGITHUB_TOKEN, or rungh auth login --scopes admin:org.feature_unavailable— the org’s plan doesn’t support organization roles (a GitHub Enterprise Cloud feature).github_api_errorwith a 403/404 — the resolved identity doesn’t have org-roles read access, the org login is wrong, or the org’s plan was indeterminate (the identity can’t readorg.plan) and the org genuinely doesn’t support organization roles — that case falls through to the real endpoint rather than reportingfeature_unavailable.