---
title: "Agents"
description: "The same 71 tools over MCP, Pi, OMP, the CLI and the AI SDK, what they hold back, and how tokens and hosts stay out of a model's hands."
canonical_url: "https://forges.agntn.dev/guide/agents"
---
# Agents

> The same 71 tools over MCP, Pi, OMP, the CLI and the AI SDK, what they hold back, and how tokens and hosts stay out of a model's hands.

## 71 tools, five surfaces

Every tool is written once, in `src/tools.ts`. [`@agntn/tools`](https://tools.agntn.dev) hands that one definition to the MCP server, both extensions, the `forges` CLI and the AI SDK. Same schema, same description, same error text. Fix it once, fixed everywhere.

<table>
<thead>
  <tr>
    <th>
      Group
    </th>
    
    <th>
      Tools
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      repositories
    </td>
    
    <td>
      <code>
        forges_repos_list
      </code>
      
      , <code>
        forges_repos_get
      </code>
      
      , <code>
        forges_repos_contents
      </code>
      
      , <code>
        forges_repos_tree
      </code>
      
      , <code>
        forges_repos_tags
      </code>
      
      , <code>
        forges_repos_labels
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      contribution templates
    </td>
    
    <td>
      <code>
        forges_contribution_templates_list
      </code>
      
      , <code>
        forges_contribution_templates_get
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      code
    </td>
    
    <td>
      <code>
        forges_code_search
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      CI and commits
    </td>
    
    <td>
      <code>
        forges_ci_runs_list
      </code>
      
      , <code>
        forges_ci_jobs_list
      </code>
      
      , <code>
        forges_ci_jobs_log
      </code>
      
      , <code>
        forges_commits_search
      </code>
      
      , <code>
        forges_commits_list
      </code>
      
      , <code>
        forges_commits_compare
      </code>
      
      , <code>
        forges_commits_get
      </code>
      
      , <code>
        forges_commits_checks
      </code>
      
      , <code>
        forges_commits_patch
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      releases
    </td>
    
    <td>
      <code>
        forges_releases_list
      </code>
      
      , <code>
        forges_releases_get
      </code>
      
      , <code>
        forges_releases_create
      </code>
      
      , <code>
        forges_releases_update
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      issues
    </td>
    
    <td>
      <code>
        forges_issues_list
      </code>
      
      , <code>
        forges_issues_search
      </code>
      
      , <code>
        forges_issues_search_global
      </code>
      
      , <code>
        forges_issues_get
      </code>
      
      , <code>
        forges_issues_comments
      </code>
      
      , <code>
        forges_issues_comments_get
      </code>
      
      , <code>
        forges_issues_reactions
      </code>
      
      , <code>
        forges_issues_events
      </code>
      
      , <code>
        forges_issues_comments_create
      </code>
      
      , <code>
        forges_issues_comments_update
      </code>
      
      , <code>
        forges_issues_comments_delete
      </code>
      
      , <code>
        forges_issues_fields
      </code>
      
      , <code>
        forges_issues_create
      </code>
      
      , <code>
        forges_issues_update
      </code>
      
      , <code>
        forges_issues_transfer
      </code>
      
      , <code>
        forges_issues_sub_issues
      </code>
      
      , <code>
        forges_issues_sub_issues_add
      </code>
      
      , <code>
        forges_issues_sub_issues_remove
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      pull requests
    </td>
    
    <td>
      <code>
        forges_pull_requests_list
      </code>
      
      , <code>
        forges_pull_requests_search
      </code>
      
      , <code>
        forges_pull_requests_search_global
      </code>
      
      , <code>
        forges_pull_requests_get
      </code>
      
      , <code>
        forges_pull_requests_files
      </code>
      
      , <code>
        forges_pull_requests_checks
      </code>
      
      , <code>
        forges_pull_requests_reviews
      </code>
      
      , <code>
        forges_pull_requests_reviews_get
      </code>
      
      , <code>
        forges_pull_requests_reviews_dismiss
      </code>
      
      , <code>
        forges_pull_requests_comments
      </code>
      
      , <code>
        forges_pull_requests_comments_get
      </code>
      
      , <code>
        forges_pull_requests_reactions
      </code>
      
      , <code>
        forges_pull_requests_events
      </code>
      
      , <code>
        forges_pull_requests_comments_create
      </code>
      
      , <code>
        forges_pull_requests_comments_update
      </code>
      
      , <code>
        forges_pull_requests_comments_delete
      </code>
      
      , <code>
        forges_pull_requests_create
      </code>
      
      , <code>
        forges_pull_requests_update
      </code>
      
      , <code>
        forges_pull_requests_merge
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      users and auth
    </td>
    
    <td>
      <code>
        forges_users_get
      </code>
      
      , <code>
        forges_users_authenticated
      </code>
      
      , <code>
        forges_auth_reload
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      review threads
    </td>
    
    <td>
      <code>
        forges_threads_list
      </code>
      
      , <code>
        forges_threads_get
      </code>
      
      , <code>
        forges_threads_reply
      </code>
      
      , <code>
        forges_threads_comments_update
      </code>
      
      , <code>
        forges_threads_comments_delete
      </code>
      
      , <code>
        forges_threads_resolve
      </code>
      
      , <code>
        forges_threads_unresolve
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      local inspection
    </td>
    
    <td>
      <code>
        forges_local_inspect
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      local Git
    </td>
    
    <td>
      <code>
        forges_local_merge_verify
      </code>
    </td>
  </tr>
</tbody>
</table>

Two shortcuts, because models kept tripping over the long form. `platform` defaults to `github`. And `repo` takes the slug everyone writes anyway, `{ "repo": "agntn/keys" }`. An `owner` next to it may repeat the slug's owner. Naming someone else fails. No guessing which one you meant.

Cloudflare Artifacts? Git without the forge around it. So only the five Git reads take `platform: "artifacts"`, and the rest don't even list it. The [Artifacts page](https://forges.agntn.dev/platforms/artifacts) has the details.

## Several issues, pull requests or threads in one call

Three issues used to mean the same tool three times in a row, like a broken record. Need several at once? Pass a list. One bad id doesn't sink the other nine.

`forges_issues_get` and `forges_pull_requests_get` take a number or a list of up to 10. `forges_threads_get`, `forges_threads_resolve` and `forges_threads_unresolve` take a thread id or a list. Lists are for MCP, Pi, OMP and the AI SDK. The CLI keeps `--number 391` and `--thread-id` to one item per command.

```json
{ "repo": "agntn/forges", "number": 398, "threadId": ["PRRT_a", "PRRT_b", "PRRT_c"] }
```

One value keeps the old answer. A list comes back in the same order. Each item has its key and a `result` or an `error`. Successful resolves stay resolved, so retry only the failed ids. An empty list or one above 10 is refused before any request.

Reads run in parallel. Resolves run one thread at a time, as GitHub asks of mutations. In a local run, three separate calls took about 1.5 s. One list took about 0.5 s, with nearly the same answer size.

Bodies share the single call's 200 000-character ceiling. Ten issues get 20 000 characters each by default. A bigger `maxChars` than that share? Refused. Continuations with `offset` and `bodyHash` take one number.

## Checks that finish

Is CI green yet? Ask `forges_pull_requests_checks` again and again, and it says "still running" again and again. Pass `waitSeconds` instead, up to 300. The call comes back once every check concludes, or when the budget runs out. A timeout isn't an error. You still get the page, plus a `wait` field with what's left.

Every page of checks counts. A green first page with page two still building isn't done.

Right after a push there's a catch. For a moment the pull request can still point at the old head, and that head's checks are all done. Green, settled and wrong. So pass the SHA you just pushed as `headSha`. Until the pull request catches up, you get no rows, a `staleHead` naming the commit it still shows, and the wait keeps going.

`forges_commits_checks` lists checks for a SHA, branch or tag. Like `forges_pull_requests_checks`, it accepts `waitSeconds` up to 300. The shell loop calling `gh api` every 20 seconds can finally go. Some checks arrive after the merge party: a Workers Builds deploy, a release, a publish. They run on the merge commit, outside the pull request's checks.

A branch or tag is pinned to its commit when the call starts, so a push in the meantime doesn't move it. The result's `sha` names that commit, and `wait` matches the pull request version. An empty list never settles it, though. A commit can't say when it was pushed, so a deploy that starts late still gets caught.

### Let CI ring the bell

Why make an agent babysit a clock? A 15 minute run used to mean a string of blocking calls. Up to 300 seconds each with `waitSeconds`. Then "call again". CI can ring its own bell.

In Pi and OMP, call `forges_checks_watch` and keep working. It answers at once with how many checks still run. Already done? Then the answer says so, and no watch starts.

A pull request takes `number` and an optional `headSha`. A commit, branch or tag takes `ref`. Never both. Pushed again? Watch the pull request again with the new SHA. The new watch replaces the old one.

```json
{ "repo": "agntn/forges", "number": 463, "headSha": "<the SHA you just pushed>" }
```

Once every check concludes, one message lands in the session. An idle agent gets a new turn. A busy one finishes first. Checks that didn't pass come with their id and URL. `forges_ci_jobs_log` reads the log. The watch gives up after `minutes`, 60 by default and 360 at most. Then it names what still ran.

The session has to stay open: interactive or RPC. A reload or resume starts the open watches again. Quitting stops them quietly. `pi -p` ends with its answer, so it refuses the call and points at `waitSeconds`. It's the one tool outside the shared set. MCP, the CLI and the AI SDK don't get it.

## Review bots that edit in place

Green CI, and the bot? A review bot rarely says "done" out loud. Codex edits one sticky comment: `Running` when its round starts, `Completed` when it ends. PR Lens does the same under its own marker.

So `forges_pull_requests_comments` waits too. `marker` keeps the comments whose body has that text. `since` keeps the ones created or edited after it. Both read every page in one call, so there's no cursor.

```json
{
  "repo": "agntn/forges",
  "number": 339,
  "marker": "codex-pull-request-review-summary",
  "since": "2026-10-26T20:50:00Z",
  "waitSeconds": 110
}
```

With `since` at your push, the first edit after it settles the call. Usually that's `Running`. Call again without `since`, and it waits for the next edit after the call starts. That one says `Completed`. Two calls, not 85 lines of `gh` in a shell loop.

You get only the changed comments. Plus `wait`: `settled`, `waitedMs`, `polls`. Bodies are still cut in a list. PR Lens puts its verdict at the bottom, so read that one whole with `forges_pull_requests_comments_get`.

`forges_pull_requests_reactions` plays by the same rules. `author` stands in for `marker`. Its wait also settles when a reaction from the first read goes away. Codex's `eyes` does that when a round ends with findings. You'll find it in `wait.removed`.

A quiet bot isn't an error. The budget runs out, `settled` is `false` and the list is empty. The note says to call again.

Changed your mind halfway? Hit Esc in Pi or OMP, or cancel the call from your MCP client. The wait ends right there. The next poll never goes out. No more five minutes of forges refreshing CI for an agent that's long gone.

Every other read lets go just as fast. A silent host can't hold your session for 30 seconds. The request runs out in the background. Nobody reads the reply.

## Local Git

Two tools read a checkout instead of a forge. No token, no fetch, no writes.

`forges_local_inspect` gives status, tracked files and the last few commit messages in one call. Point `paths` at `*AGENTS.md` and it finds every instruction file. A big repository comes back in pages.

`forges_local_merge_verify` asks something narrower. Is the merge commit on the target? Did these paths land exactly as they were on the PR head? Fetch the target first, then pass the head, the merge commit and the paths.

A match isn't a license to clean up, though. Paths you didn't list weren't checked, and refs move. Look at the live PR before deleting anything. The library has both as `inspectLocal` and `verifyLocalMerge` in `@agntn/forges/local`.

## MCP

```bash
forges mcp
claude mcp add forges --scope user -- npx -y @agntn/forges mcp
```

Or in a client's config:

```json
{
  "mcpServers": {
    "forges": { "command": "npx", "args": ["-y", "@agntn/forges", "mcp"] }
  }
}
```

That's stdio. A host with its own transport takes `createMcpServer()` from `@agntn/forges/mcp`.

Issue and pull request lists leave bodies out and name the tool that reads one in full. A page of busy issues with every body inside would push the conversation that asked for it out of the window. Two small calls beat one huge one.

Searches also leave bodies out unless `bodyChars` asks for the start of each one. Reading the starts of someone's last eight PR bodies takes one search call, not a small pilgrimage through eight more. Comments, reviews and threads keep their bodies, cut to twelve lines and 4,000 characters each, so a heavily reviewed PR wants a small `perPage`.

## Reads, writes and whose account

Reads go through the usual [token chain](https://forges.agntn.dev/guide/auth). Nothing found? They go out anonymous. That anonymous provider never gets reused for a write, not even by accident. Artifacts has no guest mode, so no token there means a clear error.

Twenty-two tools write to the host, and their MCP annotations say so. Run a create or a reply twice and you get two of them.

Updates, comment edits and deletes, the merge, a review dismissal and an issue transfer are marked destructive. Pi asks before each comment edit or delete, which is worth the interruption. A merge doesn't come back, and neither does a deleted comment.

Esc doesn't cut a write short, though. The forge may already have it. So forges waits for the answer. Guessing is how a model posts the same comment twice.

Before a model writes anything, `forges_users_authenticated` tells you whose account it'll use. Two GitHub logins in `gh`? A write can pick one with `account`. forges then asks `/user` whose token that really is and refuses on a mismatch. That check is the point. A `GH_TOKEN` in the environment still wins the lookup, and a reply signed by the wrong person looks exactly like a success. GitLab, Gitea and Artifacts don't take `account`.

The credential stays pinned until `forges_auth_reload` swaps it. Even an expired one. So a rejected token comes back with where it came from and which login to redo. Then the reload. A bare 401 tells a model nothing.

## Hosts stay local

A self hosted forge comes from `FORGES_GITHUB_BASE_URL`, `FORGES_GITLAB_BASE_URL`, `FORGES_GITEA_BASE_URL`, `FORGES_BITBUCKET_BASE_URL`, `FORGES_GITEE_BASE_URL`, `FORGES_AZURE_DEVOPS_BASE_URL`, `FORGES_GITCAFE_BASE_URL`, `FORGES_PUSHIN_BASE_URL` or `FORGES_TANGLED_BASE_URL` in the agent's environment. `FORGES_ARTIFACTS_BASE_URL` does the same for the Cloudflare API. Never a tool argument, so a model can't aim a call somewhere else. Errors name the status and, on a rate limit, when to retry. Never the endpoint.

A failed call is a sentence for the model. The session survives.

## Pi and OMP

```bash
pi install npm:@agntn/forges
```

Both extensions draw calls and results in the terminal. A repository row, pull requests with their states, a thread with its comments.

Pi stops before eight writes: creating, editing or merging a pull request, dismissing a review, editing or moving an issue, creating or editing a release. It shows what goes out and waits for a yes. No UI to ask? No write. OMP puts its own approval in front of every write.

Which repo is this, anyway? Both extensions answer before the agent asks. Each run gets the checkout's forge remotes in its system prompt, origin and upstream first, with the `platform`, `owner` and `repo` the tools take.

Plain local Git, about 7 ms, no network, no token. Credentials in a remote URL stay out. Without it the model said `unknown`. With it, GitHub, agntn, forges.

What does a Pi codemode script get back? An object now, not a string wearing JSON. Call `forges_issues_get` and read `r.result.title` directly. A list of numbers gives an array, each item with its `number` and a `result` or `error`. No more `JSON.parse` on every call, thankfully. The model still reads the same text.

## AI SDK

One import gives your model all 71 tools, no wrappers to write.

```bash
pnpm add @agntn/forges ai @ai-sdk/anthropic
```

```ts
import { anthropic } from "@ai-sdk/anthropic";
import { forgesAiTools } from "@agntn/forges/ai";
import { generateText, isStepCount } from "ai";

const { text } = await generateText({
  model: anthropic("claude-sonnet-5-5"),
  tools: forgesAiTools,
  stopWhen: isStepCount(5),
  prompt: "What's still open on agntn/forges?",
});
```

Reads run without asking. The twenty-two host writes stop at a tool approval request. So does `forges_auth_reload`, which swaps the pinned credential. Why ask? A bare `generateText` loop has nobody there to approve a merge. The model's finger can hover, but it can't press.

Your loop, your call. A `toolApproval` you pass wins over that default:

```ts
await generateText({
  model: anthropic("claude-sonnet-5-5"),
  tools: forgesAiTools,
  toolApproval: { forges_issues_comments_create: "approved" },
  prompt: "Say thanks on agntn/forges#346.",
});
```

It also takes `"denied"`, `"user-approval"` or a function. Keys are the MCP names, and the model reads the same text an MCP client gets. `ai` is an optional peer, any 7.x.

## What comes back

Normalized objects, not prose. Want to check a model's summary against the source? The [Explorer](https://forges.agntn.dev/explorer) shows the same objects for any public repository.

<caution>

Issue bodies, comments and review threads come from whoever has an account. Data to report, not instructions to follow. An agent that reads `ignore previous instructions` in an issue has learned something about the issue. Nothing about what to do next.

</caution>


## Sitemap

See the full [sitemap](https://forges.agntn.dev/sitemap.md) for all pages.
