# Grant tools to an agent

Turn on the tools an agent may call, give it a gateway token and point its MCP client at the Amiril gateway. Then revoke the tools it stops using.

This guide grants the payments agent its `issue_payment` tool and connects the agent to the Amiril gateway. It ends with revoking a tool and answering an access suggestion.

Every tool starts denied, including a tool that a server adds later.

## Before you start [#before-you-start]

- A registered agent. See [register an agent](/agents).
- A tool server with the tool on it. See [add a tool server](/tool-servers).
- The admin role. See [members and roles](/workspace/members).

## Grant a tool [#grant-a-tool]

<Steps>
<Step>
Open **Agents**, select the payments agent and open its **Access** tab. It lists each tool server with its tools. Set **Show** to **All tools** to see the denied ones as well.
</Step>

<Step>
Find `payments.issue_payment` and turn on its switch. The part before the dot is the server's [slug](/tool-servers#check-the-name-slug-and-access). Amiril says **Granted payments.issue_payment.** and the grant takes effect within a few seconds.
</Step>
</Steps>

To grant several tools on one server at once, select **Edit** on the server's heading and pick an **Access level**. **Read** ticks the server's Read tools, **Read and write** adds its Write tools and **Full** adds its Destructive tools too. Tick or untick any tool, then select **Save changes**.

## Connect the agent [#connect-the-agent]

The agent needs a gateway token to reach its tools.

<Steps>
<Step>
Open the agent's **Connect** tab and select **Create token**. Name it after where the agent runs, such as Production deployment. A token works only in the environment you create it in.
</Step>

<Step>
Select **Copy token**. Amiril shows the token only once, so store it where the agent keeps its secrets.
</Step>

<Step>
Point the agent's MCP client at the gateway. The **Client configuration** on the Connect tab has this shape with the gateway URL filled in. Put the token in place of `<token>`:

```json title="mcp.json"
{
  "mcpServers": {
    "amiril": {
      "url": "<gateway URL>",
      "headers": {
        "Authorization": "Bearer <token>"
      }
    }
  }
}
```

If your agent creates its MCP client in code, [point the agent at the gateway](/tool-servers/move-a-tool#point-the-agent-at-the-gateway) shows how in TypeScript.
</Step>
</Steps>

The agent's tool list now has `payments__issue_payment`. The app writes the tool as `payments.issue_payment`, but model APIs do not accept a dot in a tool name. So the gateway joins the slug and the tool's name with `__`. If the agent calls a tool it was not granted, the gateway answers with an error that says an admin can grant it in Amiril.

## See the agent's gateway calls [#see-the-agents-gateway-calls]

The agent's **Calls** tab lists each tool call through the gateway, newest first. **Decision** says whether the gateway allowed it, and **Result** says how the tool server answered. Amiril does not store the arguments or the results.

## Revoke a tool [#revoke-a-tool]

Turn off the tool's switch on the **Access** tab. The agent loses the tool within a few seconds. The message that confirms the revoke has **Undo**, which puts the grant back as it was.

## Answer an access suggestion [#answer-an-access-suggestion]

Amiril suggests revoking a tool when the agent was granted it more than 30 days ago and has not called it in the last 30 days. The investigator, the AI agent that writes up each [issue](/monitor/issues), can suggest a revoke too. It does so when it judges from the issue's runs that the agent should not be able to call that tool at all.

Open suggestions show above the table on the agent's **Access** tab and on the **Suggestions** page. Each one has two answers:

- **Revoke** takes the tool away.
- **Dismiss** keeps the grant. An unused tool you dismiss is not suggested again for 30 days.

A suggestion also closes on its own when it no longer applies, for example when the agent calls an unused tool. Every grant, revoke and dismissal goes into [the access log](/agents/access-log).

## Next steps

- [Add a tool server](https://docs.amiril.ai/tool-servers.md): Register the MCP server where your agents' tools live and choose how Amiril signs in to it. Then grant its tools to agents on their Access tab.
- [Move an in-process tool to a tool server](https://docs.amiril.ai/tool-servers/move-a-tool.md): Take a tool function and its API key out of your agent and put them on a tool server behind the Amiril gateway. The agent keeps one gateway token.
- [Audit agent access](https://docs.amiril.ai/agents/access-log.md): The access log lists every grant and revoke, every tool call the gateway refused and each change to tool servers, gateway tokens and agents.
- [Register and manage agents](https://docs.amiril.ai/agents.md): Amiril lists every agent it finds in your traces. Register one with a display name so it can have owners, tool grants and a gateway token.
- [Review rule suggestions](https://docs.amiril.ai/rules/suggestions.md): Amiril drafts a rule for an issue and tests it on your past runs. Read the evidence it shows, then dismiss the suggestion or create the rule as a draft.

## More detail

- [Tool servers, the gateway and agent access](https://docs.amiril.ai/assistant/tool-servers.md): Everything about registering MCP tool servers, the four sign-in methods, the Amiril gateway, tool grants, gateway tokens, sync, the access log, access suggestions and their errors.
- [HTTP API: agents](https://docs.amiril.ai/assistant/api/agents.md): The agents routes of Amiril's HTTP API: 41 operations, each with its parameters, request body, responses and token access.
- [HTTP API: access](https://docs.amiril.ai/assistant/api/access.md): The access routes of Amiril's HTTP API: 16 operations, each with its parameters, request body, responses and token access.
- [Permissions and roles](https://docs.amiril.ai/assistant/permissions.md): Every permission a change in Amiril can require, and which of the built-in roles, admin and member, has it.
- [Limits and defaults](https://docs.amiril.ai/assistant/limits.md): Every limit and default a customer can hit in Amiril, with its number: plan amounts, ingest sizes and rates, imports, rules, backtests, API and MCP rates, page sizes, retention, name lengths.
