Class GitHubTools

java.lang.Object
com.example.github.GitHubTools

public final class GitHubTools extends Object
Reusable GitHub function tools backed by the org.kohsuke:github-api client. Each returns a Map with a "status" of "success", "error" or "dry_run". Reads GITHUB_TOKEN from the environment; callers set dryRun to gate writes.

The tools cover the operations needed by the ADK GitHub automation samples: reading releases, diffs and file contents; searching code; listing and reading issues and their comments; listing repository collaborators; creating issues and pull requests; labelling/assigning issues; commenting on or closing issues; and reading, labelling and commenting on pull requests.

Defense in depth against prompt injection: the agents read untrusted GitHub content (diffs, file contents, issue/PR titles) and could be steered into harmful writes. Independently of the prompt, the write tools (a) only target writeRepoOwner/writeRepoName when set, (b) restrict pull requests to Markdown files under docs/, and (c) cap how many issues and pull requests a single run may create. The labelling/assignment/commenting tools are not separately capped: unlike issue/PR creation they do not create new objects (so they carry no unbounded-spam risk) and only mutate pre-existing issues or pull requests in the pinned target repository from (a); the consuming triaging agents additionally bind them to a fixed label allowlist and the specific issue/PR numbers the workflow authorized.