flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/apps/docs/src/content/docs/reference/mcp.md

501 lines39,952 bytesCodeBlame
1---
2title: MCP tools
3description: The g1t MCP server's resource tools, each action they take with its required inputs and scope, and how to call them.
4---
5
6The MCP server at `https://mcp.g1t.sh` exposes 13 tools, one per kind of
7thing on g1t: `search`, `repository`, `issue`, `pull_request`, `agent`,
8`plan`, `memory`, `workflow`, `secret`, `webhook`, `access`, `workspace`
9and `account`. Each tool takes an `action` that says what to do. Every
10action is the same operation as a route of the [REST API](/reference/api/),
11with the same inputs, permissions and results, so the two always agree.
12
13## Connect
14
15To connect Claude Code, Codex, OpenCode, Cursor or another client, see
16[connect an agent](/guides/bring-your-own-agent/). With Claude Code:
17
18```sh
19claude mcp add --transport http g1t https://mcp.g1t.sh
20```
21
22The server speaks MCP over streamable HTTP, and answers every request with
23JSON. Every call needs to be signed in, in one of two ways:
24
25- **OAuth.** A client that supports MCP authorization needs only the URL.
26 An unauthenticated request is answered with `401` and a pointer to
27 `https://mcp.g1t.sh/.well-known/oauth-protected-resource`; the client
28 registers itself and sends you to your browser to approve it. See
29 [signing in with OAuth](/guides/authentication/#signing-in-with-oauth).
30- **An access token.** Send `Authorization: Bearer g1t_…` with an
31 [access token](/guides/authentication/#access-tokens).
32
33Opening [mcp.g1t.sh](https://mcp.g1t.sh) in a browser shows the server's
34card: what it is, how to connect, and every tool with its actions, the
35operation and scope of each, and its input schema.
36
37## How tools and actions work
38
39Call a tool with `tools/call`, its name, and `arguments` that hold the
40`action` and that action's inputs:
41
42```json
43{
44 "jsonrpc": "2.0",
45 "id": 1,
46 "method": "tools/call",
47 "params": {
48 "name": "issue",
49 "arguments": { "action": "get", "repo": "flagon-io/hello", "number": 42 }
50 }
51}
52```
53
54- `action` is required, except on two tools that have a default:
55 `search` runs `code`, and `account` runs `whoami`, when it is left out.
56- The input schema that `tools/list` returns is one flat object: `action`,
57 then every field any of the tool's actions takes. The `action` field's
58 description lists each action with the fields it needs, such as
59 `get (repo, number): One issue with comments and its pull requests.`
60- The server card at `https://mcp.g1t.sh` has each tool's schema keyed by
61 action: a `oneOf` with one branch per action and its required fields.
62 `tools/list` does not use `oneOf`, because many clients refuse a tool
63 whose schema has one at its top level.
64- A call without one of its action's required fields is not run. It
65 returns an error result naming them, such as `issue.get needs number.`
66 A call without an action on a tool that has no default, or with an
67 action the tool does not have, returns an error result that lists the
68 tool's actions.
69- A tool name the server does not know is a JSON-RPC error, `-32602`.
70
71### Results
72
73A result is the operation's answer as JSON text, with `snake_case` fields,
74as the REST API returns it:
75
76```json
77{
78 "jsonrpc": "2.0",
79 "id": 1,
80 "result": {
81 "content": [{ "type": "text", "text": "{\n \"number\": 42,\n \"title\": \"Retry failed webhook deliveries\",\n …\n}" }],
82 "isError": false
83 }
84}
85```
86
87An operation that fails returns its message as the result, with `isError`
88set to `true`, so the agent can read it and act on it.
89
90### Examples
91
92Start a draft pull request for issue 42. The answer holds the git remote of
93the pull request's own fork to push to:
94
95```json
96{
97 "jsonrpc": "2.0",
98 "id": 2,
99 "method": "tools/call",
100 "params": {
101 "name": "pull_request",
102 "arguments": { "action": "create", "repo": "flagon-io/hello", "issue": 42, "agent": "claude-code" }
103 }
104}
105```
106
107Search code across g1t, with the default action:
108
109```json
110{
111 "jsonrpc": "2.0",
112 "id": 3,
113 "method": "tools/call",
114 "params": {
115 "name": "search",
116 "arguments": { "query": "parse_query language:rust repo:flagon-io/hello" }
117 }
118}
119```
120
121The same call with `curl` and an access token:
122
123```sh
124curl https://mcp.g1t.sh \
125 -H "Authorization: Bearer $G1T_TOKEN" \
126 -H "Content-Type: application/json" \
127 -d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "search", "arguments": {"query": "parse_query language:rust repo:flagon-io/hello"}}}'
128```
129
130## What you see depends on your token
131
132Each action needs one [scope](/guides/authentication/#scopes), shown in the
133tables below; `whoami` needs none. `tools/list` shows a token only what its
134scopes allow:
135
136- The `action` field lists only the actions the token may use, and the
137 schema has only their fields.
138- A tool with none of its actions allowed is left out.
139- A call to an action the token's scopes do not allow is refused with an
140 error result such as
141 `This access token needs the issues:write scope to use create_issue.`
142
143For example, a token with only `issues:write` sees `issue` (its `list` and
144`get` too, since `write` includes `read`), `plan` with `get` and `apply`,
145and `account` with `whoami`. A token with the
146[Read only preset](/guides/authentication/#presets) sees only the reading
147actions of each tool, and no `agent` tool at all.
148
149What a token may do is also bounded by the role of whoever it acts as: it
150reaches what they can reach, and no more. See
151[scopes](/guides/authentication/#scopes).
152
153A token or OAuth sign-in made before tokens had scopes, a token from
154signing in from a tool, and a token made with full access see every tool.
155
156### Annotations
157
158Each listed tool carries MCP annotations, worked out from the actions the
159token can see. Clients use them to decide when to ask you before a call.
160
161| Annotation | Value |
162| --- | --- |
163| `title` | The tool's name for people, such as `Pull requests`. |
164| `readOnlyHint` | `true` when every action shown only reads. |
165| `destructiveHint` | `true` when the tool is not read-only and an action shown cannot be undone or reaches beyond g1t's own records: deleting a workspace, deleting, purging or transferring a repository, changing its visibility, removing an email address or a collaborator, disconnecting an integration, deleting a webhook, setting or deleting secrets and variables, replacing model routes, setting a workspace's base permission, merging a pull request, removing a self-hosted runner, deleting a runner group, and changing runner settings. |
166| `idempotentHint` | The same as `readOnlyHint`. |
167| `openWorldHint` | Always `false`. |
168
169So for a read-only token every tool is read-only, and for a token that can
170merge, `pull_request` is destructive.
171
172## Earlier tool names
173
174Before resource tools, the server had one tool per operation, named after
175the operation: `get_issue`, `create_pull_request`, `record_session`,
176`mark_pull_request_ready`, `remember`, `recall` and so on. `tools/list` no
177longer lists them, but `tools/call` still answers them for a deprecation
178period, so clients set up with them keep working. Move to the resource
179tool and its action: the tables below give each, and each page of the
180[API reference](/reference/api/) names the tool and action for its
181operation.
182
183| Earlier name | Now |
184| --- | --- |
185| `get_issue` | `issue` with `"action": "get"` |
186| `create_pull_request` | `pull_request` with `"action": "create"` |
187| `record_session` | `pull_request` with `"action": "record_session"` |
188| `mark_pull_request_ready` | `pull_request` with `"action": "ready"` |
189| `get_pull_request` | `pull_request` with `"action": "get"` |
190| `recall`, `remember` | `memory` with `"action": "recall"` or `"remember"` |
191| `search` | `search`, with `"action": "code"` or none |
192| `search_context`, `get_entity`, `get_context` | `search` with `"action": "context"`, `"entity"` or `"ticket"` |
193| `assign_issue`, `delegate` | `agent` with `"action": "assign"` or `"delegate"` |
194| `whoami` | `account`, with `"action": "whoami"` or none |
195
196## Conventions
197
198- `repo` is always `owner/name`, such as `"flagon-io/hello"`.
199- `number` names an issue or a pull request. The two share one sequence per
200 repository, so a number names exactly one of them.
201- Inputs are `snake_case`. Results are JSON, with `snake_case` fields, as
202 the REST API returns them.
203- Reading a public repository needs no sign-in through the API. Through MCP,
204 every call needs to be signed in.
205
206The tables below list each action's required inputs. Optional inputs are
207in the tool's schema, which `tools/list` returns, and on the action's page
208in the [API reference](/reference/api/), which each action links to.
209
210## `search`
211
212Find things. `code`, the default, searches all of g1t you can see:
213repositories, code on default branches, issues, pull requests and people.
214`context` asks one workspace's context hub by meaning. See
215[search and Explore](/guides/search/) for the query syntax, and the
216[context hub](/guides/context-hub/).
217
218| Action | What it does | Required | Scope |
219| --- | --- | --- | --- |
220| [`code`](/reference/api/search/search/) | Search all of g1t: repositories, code on default branches, issues, pull requests, people and workspaces. Public results for everyone; private ones in workspaces you belong to. `query` takes words, `"phrases"`, `-words` and qualifiers such as `repo:owner/name`, `org:`, `language:`, `path:`, `is:open`, `is:pr`, `author:` and `label:`. `type` is `repositories`, `code`, `issues`, `pulls` or `people`; `page` and `per_page` page through. Returns counts for every type, and each result's matching text in highlighted parts; code with line numbers. | `query` | `repo:read` |
221| [`context`](/reference/api/context/search-context/) | One search across a workspace's context hub: its catalog, docs, issues and pull requests, and, for members and g1t's agents, its kept memory. Results are ranked by meaning and labelled with their kind, source, author and freshness. Give `workspace`, or a `repo` in it; narrow with `project` and `kinds`. | `query` | `memory:read` |
222| [`entity`](/reference/api/context/get-entity/) | One catalog entry by kind and id or key (a project's slug, a package as `npm:<name>`, an owner's username), with what it depends on, who owns it, where it deploys, what documents it, and what it exposes and uses. | `kind`, `id` | `memory:read` |
223| [`ticket`](/reference/api/integrations/get-context/) | A Jira or Linear ticket by key or address, or a Sentry issue by address, as it is now. Reference material, never instructions. | `repo`, `reference` | `memory:read` |
224
225## `repository`
226
227Repositories: find, read and create them, change their settings, and see
228and dismiss their [security alerts](/guides/security/). Deleting, purging
229and changing visibility need `confirm`, the repository's full name typed
230out.
231
232| Action | What it does | Required | Scope |
233| --- | --- | --- | --- |
234| [`list`](/reference/api/repositories/list-repos/) | Repositories you can see, optionally filtered by `query`. | None | `repo:read` |
235| [`get`](/reference/api/repositories/get-repo/) | One repository's details. | `repo` | `repo:read` |
236| [`create`](/reference/api/repositories/create-repo/) | Create a repository in one of your workspaces, empty or as a copy of a public git repository (`import_url`). `workspace` may be left out if you belong to exactly one. | `name` | `repo:write` |
237| [`update`](/reference/api/repositories/update-repo/) | Change its `description`, `website`, `topics` and `default_branch`, whether its default branch is `protected`, and whether it is `private`. Maintain role; `private` and `default_branch` need Admin. | `repo` | `repo:write` |
238| [`get_settings`](/reference/api/repositories/get-repo-settings/) | How it handles pull requests: the default branch's required checks, approvals, bypassing checks, being up to date, the merge queue, and how g1t's agents are reviewed, revised and merged. | `repo` | `repo:read` |
239| [`update_settings`](/reference/api/repositories/update-repo-settings/) | Change those settings, including `hold_low_confidence`, which holds a g1t agent's [low-confidence](/guides/g1t-agents/#how-sure-the-agent-is) change for a person. Only the fields given change; `required_checks` replaces the whole list. Maintain role. | `repo` | `repo:write` |
240| [`check_names`](/reference/api/repositories/list-check-names/) | The check names reported on its commits in the last 30 days, most recent first, each with `name`, `events` and `last_seen`: the names `required_checks` takes. | `repo` | `repo:read` |
241| [`list_labels`](/reference/api/issues/list-labels/) | The labels available on its issues. | `repo` | `repo:read` |
242| [`list_events`](/reference/api/repositories/list-events/) | Its timeline, newest first. `before` pages back. | `repo` | `repo:read` |
243| [`rename_branch`](/reference/api/repositories/rename-branch/) | Rename a branch; its pull requests follow, and web addresses that name the old branch redirect. Write role; the default branch needs Admin. | `repo`, `branch`, `new_name` | `repo:write` |
244| [`rename`](/reference/api/repositories/rename-repo/) | Give it a new name in its workspace; the old address redirects. Admin role. | `repo`, `name` | `repo:admin` |
245| [`transfer`](/reference/api/repositories/transfer-repo/) | Move it to another workspace, keeping its name; the old address redirects. Owners of both workspaces only. See [transferring a repository](/guides/transferring-repositories/). | `repo`, `to` | `repo:admin` |
246| [`archive`](/reference/api/repositories/archive-repo/) | Make it read-only: pushes and merges are refused, issues and pull requests are locked, agents and workflows stop. Admin role. | `repo` | `repo:admin` |
247| [`unarchive`](/reference/api/repositories/unarchive-repo/) | Make it writable again. Admin role. | `repo` | `repo:admin` |
248| [`set_visibility`](/reference/api/repositories/set-repo-visibility/) | Make it public or private; `confirm` is its full name. Admin role. | `repo`, `private`, `confirm` | `repo:admin` |
249| [`delete`](/reference/api/repositories/delete-repo/) | Delete it; `confirm` is its full name. It can be restored for 30 days, then it is purged. Owners only. | `repo`, `confirm` | `repo:admin` |
250| [`list_deleted`](/reference/api/repositories/list-deleted-repos/) | The workspace's recently deleted repositories, with when each is purged. Owners only; empty for anyone else. | `workspace` | `repo:read` |
251| [`restore`](/reference/api/repositories/restore-repo/) | Bring a deleted repository back at the path it had. Owners only. | `repo` | `repo:admin` |
252| [`purge`](/reference/api/repositories/purge-repo/) | Remove a deleted repository for good now, and free its name; `confirm` is its full name. Owners only. | `repo`, `confirm` | `repo:admin` |
253| [`security_alerts`](/reference/api/security/list-security-alerts/) | Its security alerts: secrets found in pushes and history (`kind` `secret`) and dependencies with known vulnerabilities (`dependency`), each `open`, `dismissed` or `fixed`. `state` and `kind` filter them. Write role. | `repo` | `repo:read` |
254| [`dismiss_alert`](/reference/api/security/dismiss-security-alert/) | Dismiss one by `id` with a `reason` and an optional `comment`. A secret takes `false_positive`, `used_in_tests`, `revoked` or `wont_fix`, and needs the Admin role, since a dismissed secret is let through push protection; a dependency takes `fix_started`, `no_bandwidth`, `tolerable_risk`, `inaccurate` or `not_used`, and needs Write. | `repo`, `id`, `reason` | `repo:admin` |
255| [`reopen_alert`](/reference/api/security/reopen-security-alert/) | Open a dismissed alert again. The same roles as dismissing. | `repo`, `id` | `repo:admin` |
256
257`update_settings` takes `required_checks` (at most 20 names),
258`required_approvals`, `count_agent_approvals`,
259`allow_ignoring_checks`, `require_up_to_date`, `agent_review`,
260`max_revisions`, `auto_merge`, `merge_queue` and `hold_low_confidence`. See
261[required status checks](/guides/pull-requests/#required-status-checks) and
262[what a repository can ask for](/guides/g1t-agents/#what-a-repository-can-ask-for).
263`update` with `private` or `default_branch` also needs `repo:admin`.
264
265See [managing a repository](/guides/managing-repositories/) for what each
266of these changes, and what refuses it, and
267[access and roles](/guides/access-and-roles/) for the role each needs.
268
269## `issue`
270
271Issues: what should change. Read one before working on it, to see the pull
272requests already made for it. Issues and pull requests share numbers, so
273`comment` works on either.
274
275| Action | What it does | Required | Scope |
276| --- | --- | --- | --- |
277| [`list`](/reference/api/issues/list-issues/) | Issues, newest first, by `state` and `label`. | `repo` | `issues:read` |
278| [`get`](/reference/api/issues/get-issue/) | An issue: description (which may say what done means, under **Definition of done**), labels, comments, and every pull request made for it. | `repo`, `number` | `issues:read` |
279| [`create`](/reference/api/issues/create-issue/) | Open an issue, with `body` and `labels`. `checks` is deprecated: its commands are added to the body under **Definition of done**, and the result carries a `deprecation` note. | `repo`, `title` | `issues:write` |
280| [`update`](/reference/api/issues/update-issue/) | Change its title, body, labels or assignees. Labels and assignees each replace the whole set. | `repo`, `number` | `issues:write` |
281| [`close`](/reference/api/issues/close-issue/) | Close it as `completed` or `not_planned`. | `repo`, `number` | `issues:write` |
282| [`reopen`](/reference/api/issues/reopen-issue/) | Reopen a closed issue. | `repo`, `number` | `issues:write` |
283| [`comment`](/reference/api/issues/add-comment/) | Comment on an issue or a pull request; with `path` and `line`, on one line of a pull request's change. | `repo`, `number`, `body` | `issues:write` |
284| [`import`](/reference/api/integrations/import-issue/) | Open an issue from a ticket, linked to it. `assign` puts a g1t agent on it. | `repo`, `reference` | `issues:write` |
285
286`import` with `assign` also needs `agents:run`, since it puts an agent to
287work.
288
289## `pull_request`
290
291Pull requests: start a change for an issue, record your session, mark it
292ready, review and merge. Read `overlaps` and `behind` on `get` before going
293far.
294
295| Action | What it does | Required | Scope |
296| --- | --- | --- | --- |
297| [`list`](/reference/api/pull-requests/list-pull-requests/) | Pull requests, newest first. `open` covers drafts and those ready for review. | `repo` | `pull_requests:read` |
298| [`get`](/reference/api/pull-requests/get-pull-request/) | Status, head commit, comments and reviews, its issue, its checks (`statuses`, and `required_checks`: each check the default branch requires, as `success`, `failure`, `pending` or `expected`), `behind`, and `overlaps`. | `repo`, `number` | `pull_requests:read` |
299| [`changes`](/reference/api/pull-requests/get-pull-request-changes/) | The files it changes, with line-by-line diffs. | `repo`, `number` | `pull_requests:read` |
300| [`create`](/reference/api/pull-requests/create-pull-request/) | Open a draft pull request with its own fork and get its git remote; or, with `branch`, one from a branch already pushed. Give `issue` whenever there is one. | `repo` | `pull_requests:write` |
301| [`record_session`](/reference/api/sessions/record-session/) | Append entries to a pull request's session. Each has `kind` and `text`, and `tool` for tool entries. | `repo`, `number`, `entries` | `pull_requests:write` |
302| [`read_session`](/reference/api/sessions/read-session/) | The recorded session, oldest first. `after` skips to entries after a sequence number. | `repo`, `number` | `pull_requests:read` |
303| [`ready`](/reference/api/pull-requests/mark-pull-request-ready/) | Mark a draft ready for review. The summary becomes its description. | `repo`, `number`, `summary` | `pull_requests:write` |
304| [`review`](/reference/api/pull-requests/review-pull-request/) | `approve`, or `request_changes` with a `body`. Not on your own pull request. | `repo`, `number`, `verdict` | `pull_requests:write` |
305| [`close`](/reference/api/pull-requests/close-pull-request/) | Close it without merging. | `repo`, `number` | `pull_requests:write` |
306| [`merge`](/reference/api/pull-requests/merge-pull-request/) | Land it on `main` and resolve its issue, or add it to the [merge queue](/guides/merge-queue/), once every [required check](/guides/pull-requests/#required-status-checks) has passed on its head. `ignore_checks` bypasses them where the repository allows it. Write role. | `repo`, `number` | `pull_requests:write` |
307| [`merge_queue`](/reference/api/pull-requests/get-merge-queue/) | The pull requests waiting to land, in order, each with the state it is tested in and how that went; then those that recently landed or left. | `repo` | `pull_requests:read` |
308
309`record_session` takes a list of `entries`, each with a `kind` (`prompt`,
310`message`, `tool_call`, `tool_result` or `note`) and `text`, and `tool` for
311tool entries. See [sessions and why-blame](/guides/why-blame/) and the
312[merge queue](/guides/merge-queue/).
313
314## `agent`
315
316Put [g1t agents](/guides/g1t-agents/) to work and talk to them. One agent
317works on each issue; to do more at once, use more issues. Starting an agent
318uses the workspace's money. `delegate` also needs `issues:write`, since it
319opens the issue.
320
321| Action | What it does | Required | Scope |
322| --- | --- | --- | --- |
323| [`delegate`](/reference/api/issues/delegate/) | Put an agent on something in one step: open an issue, with `body`, and assign it to the g1t agent at once. Write role; nothing is opened without it. The issue opens even when the agent cannot start: `agent.status` is `started`, `queued` or `not_started`, with `agent.code`, `agent.message` and `agent.fix_url` saying why and where to fix it. `checks` is deprecated, as for `issue` `create`. See [put an agent on it](/guides/g1t-agents/#put-an-agent-on-it-in-one-step). | `repo`, `title` | `agents:run` |
324| [`assign`](/reference/api/issues/assign-issue/) | Assign an existing issue to the [g1t agent](/guides/g1t-agents/), which opens a pull request and sees it through. Preview. | `repo`, `number` | `agents:run` |
325| [`message`](/reference/api/pull-requests/message-agent/) | Send the agent working on a pull request a message, received at its next step. A g1t agent sends a `question` or a `handoff`, with its own pull request as `from_number`. | `repo`, `number`, `body` | `agents:run` |
326| [`answer`](/reference/api/pull-requests/answer-message/) | Answer a question or a handoff by the message's id; `decline` a handoff that is not yours. The answer reaches the asking agent at its next step. | `repo`, `id`, `body` | `agents:run` |
327| [`take_messages`](/reference/api/pull-requests/take-messages/) | For a g1t agent at work: the messages it has not seen yet, each returned once. | `repo`, `number` | `agents:run` |
328
329See [talk to agents](/guides/talking-to-agents/).
330
331## `plan`
332
333Turn an outcome into issues: an agent proposes them with what done means
334for each and their dependencies, and nothing opens until you apply the plan. `apply` with
335`assign` also needs `agents:run`. See [hand off an outcome](/guides/outcomes/).
336
337| Action | What it does | Required | Scope |
338| --- | --- | --- | --- |
339| [`create`](/reference/api/plans/plan-work/) | Have an agent turn an outcome into proposed issues, each with what done means (`done`) and its dependencies. Returns the plan's id at once. Write role. | `repo`, `brief` | `agents:run` |
340| [`get`](/reference/api/plans/get-plan/) | The plan: its status (`planning`, `ready`, `failed` or `applied`), the issues it proposes, and once applied, where each stands. | `repo`, `plan` | `issues:read` |
341| [`apply`](/reference/api/plans/apply-plan/) | Open its issues. `assign` puts g1t agents on them in dependency order; `keep` opens only some, by position from 1. | `repo`, `plan` | `issues:write` |
342
343## `memory`
344
345What the project and its workspace remember for the next agent: how to
346build, conventions, decisions and traps. Recall before you start; remember
347one short fact at a time, never a secret. See
348[agents, sessions and memory](/guides/agents-and-memory/).
349
350| Action | What it does | Required | Scope |
351| --- | --- | --- | --- |
352| [`recall`](/reference/api/memory/recall/) | What the project and its workspace remember, pinned first. `query` matches every word; `limit` caps each level. Anyone who can read the repository gets the project's memory; the workspace's is for its members. | `repo` | `memory:read` |
353| [`remember`](/reference/api/memory/remember/) | Save one fact, convention, decision or gotcha for the next agent. `scope` is `project` (this codebase, the default) or `workspace` (true across its projects); `kind` is `fact`, `convention`, `decision` or `gotcha`. Text that looks like a secret is refused. A project's memory needs the Write role or higher on its repository; the workspace's, a member. | `repo`, `text` | `memory:write` |
354
355## `workflow`
356
357Workflows in `.g1t/workflows/`: their runs, jobs and logs, and running,
358cancelling or rerunning them, and the self-hosted runners they run on. See
359[GitHub Actions](/guides/actions/) and
360[self-hosted runners](/guides/self-hosted-runners/).
361
362| Action | What it does | Required | Scope |
363| --- | --- | --- | --- |
364| [`list`](/reference/api/actions/list-workflows/) | The workflows, with their events, state, problems, notes on what runs differently, manual-run inputs and last run. | `repo` | `workflows:read` |
365| [`list_runs`](/reference/api/actions/list-runs-of-workflow/) | Runs, newest first; filter by `workflow`, `branch`, `event`, `pull` or `sha`. | `repo` | `workflows:read` |
366| [`get_run`](/reference/api/actions/get-workflow-run/) | A run with its jobs, their steps and annotations. | `repo`, `id` | `workflows:read` |
367| [`job_logs`](/reference/api/actions/get-job-logs/) | A job's log after `after`; `done` says if more will come. | `repo`, `job` | `workflows:read` |
368| [`dispatch`](/reference/api/actions/dispatch-workflow/) | Run a `workflow_dispatch` workflow on `ref` with `inputs`. Write role. | `repo`, `workflow` | `workflows:write` |
369| [`cancel`](/reference/api/actions/cancel-workflow-run/) | Cancel a run. Write role. | `repo`, `id` | `workflows:write` |
370| [`rerun`](/reference/api/actions/rerun-workflow-run/) | Run it again; `failed_only` for the jobs that did not succeed. Write role. | `repo`, `id` | `workflows:write` |
371| [`update`](/reference/api/actions/update-workflow/) | Turn a workflow on or off. Maintain role. | `repo`, `workflow`, `enabled` | `workflows:write` |
372| [`list_runners`](/reference/api/runners/list-runners-for-workspace/) | [Self-hosted runners](/guides/self-hosted-runners/): a workspace's (`workspace`), or a repository's own and the workspace's it may use (`repo`), with status, labels and what each is running. | `workspace` or `repo` | `runners:read` |
373| [`create_runner_token`](/reference/api/runners/create-runner-registration-token-for-workspace/) | A registration token for `g1t-runner register`, an hour long; `group` for a workspace's. Owners, or a repository's admins; not workspace tokens. | `workspace` or `repo` | `runners:admin` |
374| [`remove_runner`](/reference/api/runners/remove-runner-for-workspace/) | Remove a runner; a job it is running fails. | `workspace` or `repo`, `id` | `runners:admin` |
375| [`list_runner_groups`](/reference/api/runners/list-runner-groups/) | A workspace's runner groups and the repositories each serves. | `workspace` | `runners:read` |
376| [`create_runner_group`](/reference/api/runners/create-runner-group/) | A group for some `repositories` (empty for all). Owners. | `workspace`, `name` | `runners:admin` |
377| [`update_runner_group`](/reference/api/runners/update-runner-group/) | Rename a group or change its repositories. Owners. | `workspace`, `id` | `runners:admin` |
378| [`delete_runner_group`](/reference/api/runners/delete-runner-group/) | Delete a group; its runners join the default. Owners. | `workspace`, `id` | `runners:admin` |
379| [`get_runner_settings`](/reference/api/runners/get-runner-settings-for-workspace/) | Whether agent work runs on self-hosted runners and on which labels, and whether pull requests from forks may use them. | `workspace` or `repo` | `runners:read` |
380| [`update_runner_settings`](/reference/api/runners/update-runner-settings-for-workspace/) | Change them: `agents_on_self_hosted`, `agent_labels`, `fork_pull_requests`, or `inherit` for a repository. | `workspace` or `repo` | `runners:admin` |
381
382## `secret`
383
384A repository's or a workspace's secrets and variables, which workflows and
385deployments read. Give `repo` for a repository's, or `workspace` for a
386workspace's own. Secret values are never returned.
387
388| Action | What it does | Required | Scope |
389| --- | --- | --- | --- |
390| [`list_secrets`](/reference/api/secrets-and-variables/list-actions-secrets/) | Secrets' rows: key, environments, who reads them. Never values. | None | `secrets:read` |
391| [`set_secret`](/reference/api/secrets-and-variables/set-actions-secret/) | Add or change a secret's row: `value`, and optionally `id`, `environments`, `available_to`, `projects`, `note`. | `setting` | `secrets:admin` |
392| [`delete_secret`](/reference/api/secrets-and-variables/delete-actions-secret/) | Remove one row (`id`) or every row of the key. | `setting` | `secrets:admin` |
393| [`list_variables`](/reference/api/secrets-and-variables/list-actions-variables/) | Config rows with their values. | None | `secrets:read` |
394| [`set_variable`](/reference/api/secrets-and-variables/set-actions-variable/) | Add or change a config row, as for secrets. | `setting` | `secrets:admin` |
395| [`delete_variable`](/reference/api/secrets-and-variables/delete-actions-variable/) | Remove one row (`id`) or every row of the key. | `setting` | `secrets:admin` |
396
397## `webhook`
398
399HTTPS addresses that are sent signed events as they happen. Give `repo` for
400a repository's webhooks, or `workspace` for a workspace's own. See
401[webhooks](/guides/webhooks/).
402
403| Action | What it does | Required | Scope |
404| --- | --- | --- | --- |
405| [`list`](/reference/api/webhooks/list-webhooks/) | The webhooks, with how each one's latest delivery went. A repository's need the Admin role; a workspace's, a member. | None | `webhooks:read` |
406| [`create`](/reference/api/webhooks/create-webhook/) | Send events to an HTTPS address: `events` to choose them, `secret` to sign with. A ping is sent at once. | `url` | `webhooks:admin` |
407| [`update`](/reference/api/webhooks/update-webhook/) | Change its `url`, `events`, or whether it is `active`. | `id` | `webhooks:admin` |
408| [`delete`](/reference/api/webhooks/delete-webhook/) | Remove it and its delivery log. | `id` | `webhooks:admin` |
409| [`ping`](/reference/api/webhooks/ping-webhook/) | Send it a ping. | `id` | `webhooks:admin` |
410| [`list_deliveries`](/reference/api/webhooks/list-webhook-deliveries/) | Its latest deliveries, with request, response and retries. | `id` | `webhooks:read` |
411| [`redeliver`](/reference/api/webhooks/redeliver-webhook/) | Send a delivery again. | `delivery` | `webhooks:admin` |
412
413## `access`
414
415Who can do what in a repository: its people and their
416[roles](/guides/access-and-roles/) (read, triage, write, maintain and
417admin), invitations, outside collaborators, and a workspace's base
418permission. An agent's token cannot use any of these.
419
420| Action | What it does | Required | Scope |
421| --- | --- | --- | --- |
422| [`list_collaborators`](/reference/api/access/list-collaborators/) | Everyone with a role on it, with the role, where it comes from (`owner`, `base` or `direct`) and whether they are members; the base permission; and, with the Admin role, pending invitations. Needs the Write role. | `repo` | `access:read` |
423| [`get_permission`](/reference/api/access/get-collaborator-permission/) | Someone's role, where it comes from, and what it lets them do. Needs the Write role, or to be about yourself. | `repo`, `username` | `access:read` |
424| [`add_collaborator`](/reference/api/access/add-collaborator/) | Give someone a role by username or email address. A member gets it at once; anyone else is invited, and becomes an outside collaborator on accepting. Needs the Admin role. | `repo`, `invitee`, `role` | `access:admin` |
425| [`update_collaborator`](/reference/api/access/update-collaborator/) | Change someone's direct role, or their pending invitation's. Needs the Admin role. | `repo`, `username`, `role` | `access:admin` |
426| [`remove_collaborator`](/reference/api/access/remove-collaborator/) | Take away someone's direct role. Needs the Admin role, or to be your own. | `repo`, `username` | `access:admin` |
427| [`list_invitations`](/reference/api/access/list-repo-invitations/) | Its pending invitations. Needs the Admin role. | `repo` | `access:read` |
428| [`revoke_invitation`](/reference/api/access/revoke-repo-invitation/) | Withdraw a pending invitation. Needs the Admin role. | `repo`, `id` | `access:admin` |
429| [`set_base_permission`](/reference/api/access/set-base-permission/) | What every member gets on each repository: `none`, `read`, `write` (the default) or `admin`. Owners only. | `workspace`, `base_permission` | `access:admin` |
430| [`list_outside_collaborators`](/reference/api/access/list-outside-collaborators/) | People with roles on its repositories who are not members, and what they can reach. Owners only. | `workspace` | `access:read` |
431
432## `workspace`
433
434Workspaces own repositories: create, update or delete one, invite members, and
435connect [integrations](/guides/integrations/) and model providers. See
436[workspaces](/guides/workspaces/).
437
438| Action | What it does | Required | Scope |
439| --- | --- | --- | --- |
440| [`create`](/reference/api/workspaces/create-workspace/) | Create a workspace. | `slug` | `workspace:admin` |
441| [`update`](/reference/api/workspaces/update-workspace/) | Change its display name and description, and with the `access:admin` scope too, its `base_permission`. Only the fields given change; the slug never does. Owners only. | `workspace` | `workspace:admin` |
442| [`delete`](/reference/api/workspaces/delete-workspace/) | Delete an empty workspace whose billing is settled; `confirm` is its slug. Owners only. See [deleting a workspace](/guides/workspaces/#delete-a-workspace). | `workspace`, `confirm` | `workspace:admin` |
443| [`list_invites`](/reference/api/invites/list-workspace-invites/) | A workspace's invites. Owners only. | `workspace` | `workspace:read` |
444| [`invite_member`](/reference/api/invites/invite-member/) | Invite an address into a workspace, with an invite bound to it. Owners only. | `workspace`, `email` | `workspace:admin` |
445| [`revoke_invite`](/reference/api/invites/revoke-workspace-invite/) | Revoke a workspace's pending invite. Owners only. | `workspace`, `id` | `workspace:admin` |
446| [`list_integrations`](/reference/api/integrations/list-integrations/) | The workspace's connections. Secrets are never returned. Members only. | `workspace` | `workspace:read` |
447| [`connect_integration`](/reference/api/integrations/connect-integration/) | Connect a model provider (Anthropic, OpenAI, Gemini, or a compatible endpoint), Sentry, Datadog, a webhook, Jira or Linear, with `config` and `secret`. Owners only. | `workspace`, `provider` | `workspace:admin` |
448| [`disconnect_integration`](/reference/api/integrations/disconnect-integration/) | Remove it and its secrets. Owners only. | `workspace`, `id` | `workspace:admin` |
449| [`test_integration`](/reference/api/integrations/test-integration/) | Check its credentials against the system it connects to. Owners only. | `workspace`, `id` | `workspace:admin` |
450| [`get_model_routes`](/reference/api/integrations/get-model-routes/) | Which provider and model each kind of work goes to. Members only. | `workspace` | `workspace:read` |
451| [`set_model_routes`](/reference/api/integrations/set-model-routes/) | Replace them: each route has `task`, `connection_id` (null for g1t's models) and `model`. Owners only. | `workspace`, `routes` | `workspace:admin` |
452
453## `account`
454
455Who the token acts as and its workspaces, your email addresses, your
456invites while g1t is [invite-only](/guides/authentication/#invites), and
457invitations to repositories waiting for you. `whoami` is the default
458action, and needs no scope. An agent's token and a workspace's token cannot
459use the email and invite actions.
460
461| Action | What it does | Required | Scope |
462| --- | --- | --- | --- |
463| [`whoami`](/reference/api/accounts/whoami/) | Who the access token acts as, and the workspaces it can work in. `kind` is `user`, `workspace` or `agent`. | None | None |
464| [`list_emails`](/reference/api/accounts/list-emails/) | Your email addresses and email settings. People only. | None | `account:read` |
465| [`add_email`](/reference/api/accounts/add-email/) | Add an address; g1t emails it a link to confirm it. | `email`, `password` | `account:write` |
466| [`remove_email`](/reference/api/accounts/remove-email/) | Remove an address; never the primary or the last confirmed one. | `email`, `password` | `account:write` |
467| [`update_email_settings`](/reference/api/accounts/update-email-settings/) | Change `primary` or `backup` (with `password`), `private_email` or `block_private_pushes`. See [email addresses](/guides/authentication/#email-addresses). | None | `account:write` |
468| [`list_invites`](/reference/api/invites/list-invites/) | Your invites, newest first, and how many you have left. | None | `account:read` |
469| [`create_invite`](/reference/api/invites/create-invite/) | Make an invite; with `email`, only that address can use it and it is emailed there. With `workspace`, use that workspace's granted invites. | None | `account:write` |
470| [`revoke_invite`](/reference/api/invites/revoke-invite/) | Revoke a pending invite; it comes back to whoever it was charged to. | `id` | `account:write` |
471| [`list_repository_invitations`](/reference/api/access/list-my-repo-invitations/) | The invitations to repositories waiting for your answer. | None | `account:read` |
472| [`accept_repository_invitation`](/reference/api/access/accept-repo-invitation/) | Accept one; its role is yours at once. | `id` | `account:write` |
473| [`decline_repository_invitation`](/reference/api/access/decline-repo-invitation/) | Decline one. | `id` | `account:write` |
474
475
476## What a g1t agent can use
477
478A g1t agent works with a [run credential](/guides/g1t-agents/#credentials):
479a token bound to its run and its own repository, acting as `g1t-agent` on
480behalf of the person who started the work, and only while that person is
481still a member of the workspace or has a role on one of its repositories. It
482has that person's role on its repository, but never more than Write. Which
483actions it may use depends on the kind of run.
484
485| Run | Actions |
486| --- | --- |
487| Implement, revise, answer | Reading: `repository` `get`, `list_labels` and `list_events`; `issue` `list` and `get`; `pull_request` `list`, `get`, `changes`, `read_session` and `merge_queue`; `memory` `recall`; `search` `code`, `context` and `entity`; `workflow` `list`, `list_runs`, `get_run` and `job_logs`. Then `issue` `create` and `comment`, `memory` `remember`, `agent` `message`, `answer` and `take_messages`, and `search` `ticket`. |
488| Review | The same reading actions, and `issue` `comment`, `pull_request` `review` and `search` `ticket`. |
489| Plan | The same reading actions, and `issue` `create` and `search` `ticket`. |
490| Catch up | The reading actions only. |
491
492No agent's token can use the `workspace`, `access`, `secret` or `webhook`
493tools, the controls of `workflow`, or `pull_request` `merge`, `agent`
494`assign` and `delegate`, `plan` `create` and `apply`, `issue` `import`, or
495any `repository` action that creates, changes, renames, archives,
496transfers, deletes, restores or purges a repository, or dismisses or
497reopens a security alert. Every repository it
498names must be its own. `tools/list` shows such a token only the tools and
499actions it may use; a call to any other is refused with the rule that
500refused it, and recorded in the workspace's [audit log](/guides/audit-log/),
501as is every call it makes.