# GitHub Tools

Packages the GitHub tools you pick for AI Agent `tools` input.

- Select either a `github` GitHub App installation connection or a `github_oauth` ordinary GitHub OAuth user connection.
- Pick the tools to emit in `tools`, a list of tool names without the `github_` prefix, for example `["list_issues", "get_pull_request"]`. The list starts empty, so the node emits nothing until you pick a tool.
- Wire `tools` output into an AI Agent `tools` input.
- This node does not call GitHub during workflow execution. The agent calls GitHub only when it invokes an emitted tool.
- OAuth uses exactly `repo` or `public_repo`. A GitHub App installation needs the matching repository permissions: Issues and Pull requests read for the read tools, write for the write tools.

## Tool groups

Agents and the Connection Tool Provider node get the same tools from six GitHub tool groups, one per area. Each group names its GitHub connection and has one switch per tool, named like the node's tool names. Every switch is on until you turn it off.

| Group | Tools |
|---|---|
| `github_repositories` | `list_repositories`, `get_repository` |
| `github_issues` | `list_issues`, `search_issues`, `get_issue`, `view_issue_attachment`, `create_issue`, `update_issue`, `add_issue_labels`, `remove_issue_label`, `add_issue_assignees`, `remove_issue_assignees` |
| `github_issue_comments` | `list_issue_comments`, `get_issue_comment`, `create_issue_comment`, `update_issue_comment`, `delete_issue_comment` |
| `github_pull_requests` | `get_pull_request`, `view_pull_request_attachment`, `get_pull_request_diff`, `list_pull_request_files`, `list_pull_request_commits`, `create_pull_request`, `update_pull_request`, `merge_pull_request`, `request_pull_request_reviewers`, `remove_pull_request_reviewers` |
| `github_pull_request_reviews` | `list_pull_request_reviews`, `get_pull_request_review`, `list_comments_for_pull_request_review`, `create_pull_request_review`, `update_pull_request_review`, `submit_pull_request_review`, `dismiss_pull_request_review`, `delete_pending_pull_request_review` |
| `github_review_comments` | `list_pull_request_review_comments`, `get_pull_request_review_comment`, `create_pull_request_review_comment`, `reply_to_pull_request_review_comment`, `update_pull_request_review_comment`, `delete_pull_request_review_comment` |

The node and each group take a **Retry** setting, off by default, which every request of their tools follows; see [Retries](http_get.md#retries). Requests are judged by method: `GET` reads, `PUT` and `DELETE` are sent again freely; `POST` and `PATCH` writes only when GitHub refused them before acting: the connection never opened, or GitHub answered 425 or 429.

## Tool names

Every emitted tool is called `<handle>__<tool>`, where `<handle>` is the fixed handle of the
configured GitHub connection, for example `github__github_list_issues`. The prefix is there even
when the workspace has a single GitHub connection. Renaming the connection never changes it. A
name longer than 64 characters keeps its first 55 characters and ends with `_` and an 8-character
hash. The names below, and the cross-references in tool descriptions, are the `<tool>` part.

## Tools

Read-only:

- `github_list_repositories`, `github_get_repository`
- `github_list_issues` — issues and pull requests in one listing
- `github_search_issues` — GitHub search across repositories
- `github_get_issue` — an issue or pull request by number
- `github_get_pull_request` — branches, head SHA, merge state, requested reviewers, diff size
- `github_get_pull_request_diff` — the change as a unified diff or a patch series
- `github_list_pull_request_files`, `github_list_pull_request_commits`
- `github_list_issue_comments`, `github_get_issue_comment` — conversation comments
- [`github_view_issue_attachment`](/docs/tools/GitHubViewIssueAttachmentTool), [`github_view_pull_request_attachment`](/docs/tools/GitHubViewPullRequestAttachmentTool) — files uploaded to an issue or pull request
- `github_list_pull_request_reviews`, `github_get_pull_request_review` — reviews
- `github_list_comments_for_pull_request_review` — the inline comments one review made
- `github_list_pull_request_review_comments`, `github_get_pull_request_review_comment` — inline review comments

Write:

- `github_create_issue`, `github_update_issue`
- `github_add_issue_labels`, `github_remove_issue_label`
- `github_add_issue_assignees`, `github_remove_issue_assignees`
- `github_create_issue_comment`, `github_update_issue_comment`, `github_delete_issue_comment`
- `github_create_pull_request`, `github_update_pull_request`, `github_merge_pull_request`
- `github_request_pull_request_reviewers`, `github_remove_pull_request_reviewers`
- `github_create_pull_request_review`, `github_update_pull_request_review`, `github_submit_pull_request_review`, `github_dismiss_pull_request_review`, `github_delete_pending_pull_request_review`
- `github_create_pull_request_review_comment`, `github_reply_to_pull_request_review_comment`, `github_update_pull_request_review_comment`, `github_delete_pull_request_review_comment`

The node's `tools` entries and each group's switches are named after the tool without the `github_` prefix.

## Scope

These tools read and manage repositories, issues, pull requests, their conversations, and their code reviews.

They do not commit code, edit files, create or delete branches, or perform repository administration. Merging is the one pull request action that changes a branch.

## Issues and pull requests are one listing

GitHub numbers issues and pull requests in a single sequence, and `/issues` returns both. These tools mirror that rather than inventing an issues-only endpoint:

- `github_list_issues` returns both. An item that is a pull request carries GitHub's `pull_request` key, and `type` narrows to one (`all`, `issue`, `pull_request`; default `all`).
- The type filter applies before `offset` and `limit`, so a filtered page is a full page and `has_more` describes the filtered sequence.
- `github_get_issue` resolves either kind by number. `github_update_issue`, the label and assignee tools, and the conversation comment tools take either number too.
- `github_get_pull_request` is separate because `/pulls/{number}` is the only endpoint carrying `base`, `head` (with their SHAs), `draft`, merge state, requested reviewers, and diff size. `github_update_pull_request` is separate for the same reason: base branch and maintainer access exist only on pull requests.

## Three kinds of pull request discussion

GitHub keeps these apart, and so do the tools:

- **Conversation comments** sit on the timeline of an issue or pull request: `github_*_issue_comment`.
- **Reviews** are a verdict (`APPROVED`, `CHANGES_REQUESTED`, `COMMENTED`, `DISMISSED`, `PENDING`) with a summary: `github_*_pull_request_review`.
- **Review comments** are anchored to a file and line of the diff: `github_*_pull_request_review_comment`. Each carries `pull_request_review_id` for the review it belongs to and `in_reply_to_id` for the thread it answers. A comment whose `line` is null is outdated; `original_line` says where it was.

A conversation comment id and a review comment id address different resources; pass each to its own tools.

A review created without `event` stays `PENDING`, visible only to its author, until `github_submit_pull_request_review`; `github_delete_pending_pull_request_review` discards it with its draft comments. A submitted review cannot be deleted, only dismissed. `github_list_comments_for_pull_request_review` lists one review's inline comments without scanning the whole pull request. GitHub only dismisses approvals and change requests, and refuses a verdict other than `COMMENT` on the author's own pull request.

## Pagination

- List tools accept `limit` and `offset`. `limit` defaults to `20` and is capped at `100`; `offset` defaults to `0` and counts items, not GitHub pages.
- Every list result carries `count`, `limit`, `offset`, `has_more`, and `next_offset`. `next_offset` is where the next page starts while `has_more` is true, and `null` at the end; pass it back as `offset` to continue. A page can hold fewer than `limit` items when the items are large (see below); `next_offset` then continues from the first item it left out.
- Each call walks GitHub's pages from the first, following its `Link` header, so a deep offset costs one GitHub request per 100 items before it.
- Offsets are positions in a live listing. An item created or closed between calls shifts later positions.
- GitHub caps some listings: pull request files at 3000 and pull request commits at 250.
- `github_search_issues` also returns `total_count`, `incomplete_results` (GitHub timed out before searching everywhere, on any page read), `result_limit` (`1000`), and `results_capped`. GitHub serves only the first 1000 matches of a query, so when `results_capped` is true, `has_more` running out does not mean every match was seen; narrow the query to reach the rest.

## Viewing attachments

`github_get_issue`, `github_get_pull_request`, `github_get_issue_comment` and
`github_list_issue_comments` return `attachments` for GitHub uploads linked in the issue or
pull request description or its conversation comments. Pass the listed `attachment_id` and
the repository and parent number to the viewer. Both viewers are available with GitHub OAuth
and GitHub App installation connections; GitHub can refuse a file the connection can't read.

## Results are GitHub's JSON, bounded in size

Every result carries GitHub's objects as GitHub returns them, with every field, so GitHub's REST documentation describes them. What is bounded is size, because a single call must not crowd out the conversation: a result that fills the model's context forces a compaction, and the compaction discards the result the call just fetched.

- One result holds at most about 100,000 characters, well inside the agent loop's own 256,000-character limit.
- In a list, any string longer than 2,000 characters is cut, and a page holds as many items as fit.
- In an item fetched by number or id, any string other than the body is cut at 20,000 characters.
- Every cut is named in `truncated` by its path, such as `items[3].body` or `comment.diff_hunk`. A field not named there is GitHub's whole value.

## Reading long text

Nothing long is out of reach: a getter returns one window of the full text and says where the next starts.

- `github_get_issue`, `github_get_pull_request`, `github_get_issue_comment`, `github_get_pull_request_review`, and `github_get_pull_request_review_comment` return up to 40,000 characters of the body. `github_get_pull_request_diff` returns up to 80,000 characters of the diff or patch.
- Each such result carries `text_window`: `unit` (`characters`), `offset`, `returned`, `total`, and `next_offset`. Offsets count Unicode characters.
- When `next_offset` is not null, call the same tool again with `text_offset` set to it.
- Every commit's full message is in `github_get_pull_request_diff` with `format: patch`.

## Parameters

- Operations targeting a specific repository accept optional `owner`. A trimmed explicit owner wins; otherwise the App installation account login is used for `github`, or the verified user login for `github_oauth`.
- `github_list_repositories` and `github_search_issues` do not accept `owner`.
- `repo` is the repository name without owner.
- Repository listing uses `/installation/repositories` for `github` and `/user/repos` for `github_oauth`.
- `state` filters are `open`, `closed`, or `all`; omit them or pass `null` for GitHub's default open state.
- `issue_number`, `pull_number`, `comment_id`, and `review_id` are integers.
- Text the agent passes is sent literally; template syntax in a comment is part of the comment.
- `github_search_issues` takes GitHub's advanced search syntax and needs `is:issue` or `is:pr` for some connections. GitHub allows about 30 searches a minute.
- Label, assignee, and reviewer arrays are sent exactly as given; a label name containing a comma stays one label.
- `github_update_issue` and `github_update_pull_request` change only the fields given; null and empty strings leave a field alone. `labels` and `assignees` replace the whole set, and an empty array clears it; `clear_milestone` removes the milestone. To change one label or assignee, use the add and remove tools.
- `github_merge_pull_request` accepts `sha`, normally `head.sha` from `github_get_pull_request`, to refuse a merge if the branch moved.
- Review comments take `commit_id` (normally `head.sha`), `path`, and the `line` the comment ends on, on `side` `RIGHT` (head) or `LEFT` (base); `start_line` makes a range, and `subject_type: file` comments on the whole file.
- When GitHub refuses a request, the error carries its status and GitHub's own explanation, such as a missing permission or why a merge is not possible.

Write tools should only be used when the user clearly asks for the action or confirms it.
