# Choose an integration’s tools

A connected integration gives an agent its tools, such as creating a file. The agent can call every tool you turn on, so tick only the ones it needs.

## Before you start

You need an agent with no tools yet. See [Create an agent](/docs/agents/create-agent.md). An app other than Veryfront must be connected first.

## Choose the tools

**Code**

1. Name each tool your agent may call in its `tools`, by its ID, here Veryfront's `create_file`:

```ts title="agents/support.ts" {7}
import { agent } from "veryfront/agent";

export default agent({
  id: "support",
  name: "Support assistant",
  system: "Answer customer questions about orders and refunds. Keep replies to two sentences.",
  tools: { create_file: true },
});
```

2. Start the project with `npm run dev`.
3. In Studio, open **Chat**.
4. Pick Support assistant.
5. Ask "Create the file notes/welcome.md that says Welcome to support.". You should now see it call `veryfront__create_file` and say it created `notes/welcome.md`.

### Try it in a sandbox

```playground
step: Create a project | npm create -y veryfront@latest support-desk -- --template ai-agent --yes
step: Set the tools | cd support-desk && mkdir -p agents && printf '%s\n' 'import { agent } from "veryfront/agent";' '' 'export default agent({' '  id: "support",' '  name: "Support assistant",' '  system: "Answer customer questions about orders and refunds. Keep replies to two sentences.",' '  tools: { create_file: true },' '});' > agents/support.ts
step: Start it | npm run dev
agent: support
ask: Create the file notes/welcome.md that says Welcome to support.
tool: veryfront__create_file
```

**Studio**

1. In your project, open **Agents**.
2. Click your agent.
3. Click **Edit**.
4. Under **Add tools** > **Integrations**, turn on **Veryfront**. You should now see "All 38 tools" under **Veryfront**.
5. Click the options button on the **Veryfront** row.
6. Click **Configure**.
7. Click **Disable all**.
8. Tick **Create file**.
9. Click **Save**. You should now see **Callable tools** read `1 selected` on the agent's page.

**API**

These calls change the agent on the main branch. To change it on a preview branch, add `?source_target_kind=preview_branch&target_branch_id=$BRANCH_ID` to both URLs before you run them, where `$BRANCH_ID` is the branch's `id` from `GET /projects/$PROJECT/branches`.

1. Set `PROJECT` to your project's ID ([Find your IDs](/docs/authentication/api-keys.md#find-your-ids)): `export PROJECT=<id>`.
2. Set the tools of your agent, here `support`, with your [API key](/docs/authentication/api-keys.md). Name each tool by its ID. `tool_ids` replaces the agent's whole list, so name its other tools too; the fields you don't send stay as they are:

```bash
curl -X PUT https://api.veryfront.com/projects/$PROJECT/agents/support \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tool_ids": ["create_file"]}'
```

3. Get the agent. You should now see `"tool_ids": ["create_file"]`:

```bash
curl https://api.veryfront.com/projects/$PROJECT/agents/support \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

### Try it in a sandbox

```playground
step: Set PROJECT | export PROJECT=$VERYFRONT_PROJECT_ID
step: Before you start: an agent | curl -X POST https://api.veryfront.com/projects/$PROJECT/agents -H "Authorization: Bearer $VERYFRONT_API_KEY" -H "Content-Type: application/json" -d '{"id": "support", "name": "Support assistant", "system_prompt": "Answer customer questions about orders and refunds. Keep replies to two sentences."}'
step: Set the tools | curl -X PUT https://api.veryfront.com/projects/$PROJECT/agents/support -H "Authorization: Bearer $VERYFRONT_API_KEY" -H "Content-Type: application/json" -d '{"tool_ids": ["create_file"]}'
check: curl https://api.veryfront.com/projects/$PROJECT/agents/support -H "Authorization: Bearer $VERYFRONT_API_KEY"
expect: "tool_ids":["create_file"]
```

## With MCP

On a preview branch, pass `"source_target_kind": "preview_branch"` and the branch's ID as `target_branch_id` (`veryfront__list_branches` lists them) in the call below, or it changes the agent on the main branch.

1. Call `veryfront__update_agent` with your agent's ID as `agent_id` (here `support`; `veryfront__list_agents` lists them), `"project_reference": "my-project"` and `"tool_ids": ["create_file"]`. The project reference is its slug or its ID. `tool_ids` replaces the agent's whole list, so name its other tools too. `veryfront__list_agent_tool_references` finds a tool's ID by a `query`, such as `create file`.
2. It worked when the answer lists `create_file` in `tool_ids`.

## Next steps

* [Connect an app](/docs/integrations/connect-app.md)
* [Add a tool](/docs/agents/tools.md)
