LearnNewsExamplesServices
Frontmatter
id7624
titleCreate Generic `get_viewer_permission` Tool
stateClosed
labels
enhancementai
assigneestobiu
createdAtOct 23, 2025, 4:41 PM
updatedAtOct 23, 2025, 4:56 PM
githubUrlhttps://github.com/neomjs/neo/issues/7624
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 23, 2025, 4:56 PM

Create Generic get_viewer_permission Tool

Closed v11.0.0 enhancementai
tobiu
tobiu commented on Oct 23, 2025, 4:41 PM

To safely perform restricted actions like assigning issues, merging pull requests, or adding certain labels, an agent must first know its permission level for the repository. Creating a specific permission-checking tool for each action (e.g., can_assign_issues, can_merge_prs) is not scalable.

A much better approach is to create a single, generic tool that reports the user's permission level, allowing the agent to make an informed decision about its capabilities.

Proposed Solution

Create a new, read-only tool named get_viewer_permission.

Implementation:

  1. The tool will use a new GraphQL query to fetch the viewerPermission field on the repository object.
  2. This field returns the permission level of the user whose token is being used for the API request.

Output:

The tool will return a single string representing the user's permission level. The possible values are:

  • ADMIN: Can read, write, and manage the repository.
  • MAINTAIN: Can read, write, and manage issues and pull requests.
  • WRITE: Can read and write to the repository.
  • TRIAGE: Can manage issues and pull requests.
  • READ: Can read the repository.

Usage:

An agent will call this tool once to determine its capability level. It can then use this information to decide whether to proceed with restricted actions. For example, to assign an issue, the agent would first call get_viewer_permission and only proceed to call assign_issue if the returned value is ADMIN, MAINTAIN, or WRITE.

tobiu assigned to @tobiu on Oct 23, 2025, 4:41 PM
tobiu added the enhancement label on Oct 23, 2025, 4:41 PM
tobiu added the ai label on Oct 23, 2025, 4:41 PM
tobiu referenced in commit 097294e - "Create Generic get_viewer_permission Tool #7624" on Oct 23, 2025, 4:56 PM
tobiu closed this issue on Oct 23, 2025, 4:56 PM
tobiu cross-referenced by #7625 on Oct 23, 2025, 5:21 PM