Guide
Scope with Presets
Expose only the tools your workflow needs using presets.
Presets limit the tools your agent can access to a specific workflow. This reduces the attack surface and keeps prompts focused.
AI assistant prompt (presets & scope)
Prompt
Tighten GitHub tool scope for this assistant using @github-tools/sdk.
- Switch to the smallest preset that still satisfies the feature; use an array to combine presets if needed (see https://github-tools.com/guide/presets)
- Align the GitHub PAT with https://github-tools.com/guide/token-permissions
Apply a single preset
Use a preset to restrict the tools to a specific capability domain. For example, a code review bot only needs pull request and commit tools:
review-bot.ts
import { createGithubTools } from '@github-tools/sdk'
const tools = createGithubTools({
preset: 'code-review',
})
Combine multiple presets
When a workflow spans multiple domains, pass an array. This agent can both review PRs and manage issues:
triage-and-review.ts
import { createGithubTools } from '@github-tools/sdk'
const tools = createGithubTools({
preset: ['code-review', 'issue-triage'],
})
Pick the right preset
| Preset | Tools included | Use case |
|---|---|---|
repo-explorer | repository metadata, branches, file content, code search, gists, workflows | knowledge retrieval, repo Q&A |
ci-ops | workflows, runs, jobs, commits, repository context | CI monitoring, build ops |
code-review | pull requests, commits, file diffs, review comments | PR copilots, change summaries |
issue-triage | issues, labels, comments, close/create | support triage, backlog bots |
maintainer | all tool families including branch creation, forking, repo creation, gists, and workflows | operator workflows with strict approvals |
Pair presets with token scopes
Each preset maps to specific GitHub token permissions:
repo-explorer— read-only token, no write permissions neededcode-review— addpull_requests: writeonly if comments are neededissue-triage— addissues: writeci-ops— addactions: writefor triggering, cancelling, and re-running workflowsmaintainer— all write scopes, always paired with approval control
Default to the smallest preset that can complete the task. Add more capabilities only after your prompt and approval policy are stable.