> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Add tools

> Give your agent tools: TypeScript functions the model can call, with secrets from the agent's environment and a person's approval where it matters.

A tool is a function the model can call. Each file in `agent/tools/` is one tool, and the file name is the name the model sees:

```ts agent/tools/get_invoice.ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { defineTool } from "eve/tools";
import { z } from "zod";

export default defineTool({
  description: "Look up an invoice by its number.",
  inputSchema: z.object({ number: z.string() }),
  async execute({ number }) {
    const res = await fetch(`https://billing.example.com/invoices/${number}`, {
      headers: { authorization: `Bearer ${process.env.BILLING_TOKEN}` },
    });
    return res.json();
  },
});
```

* Write `description` for the model: what the tool does and when to use it.
* Tools run in the agent's own process, so they can read `process.env`. Set a secret with `jaccard env add BILLING_TOKEN`, and add it to `.env.local` for `pnpm dev`. Never put it in a source file.
* To make a person approve each call, add `approval: always()` from `eve/tools/approval`. Use it on tools that spend money, change data or read something sensitive.

> [!WARNING]
>
> A restart can run a tool call again. Make tools that spend money or send messages safe to repeat, for example by passing an operation ID to the system they call.

Every agent also has built-in tools to run shell commands and read and write files in its sandbox.

To go further, see eve's documentation:

* [Tools](https://eve.dev/docs/tools): every option a tool takes.
* [Human in the loop](https://eve.dev/docs/human-in-the-loop): approvals, and questions the agent asks a person while it works.
* [Tasks](https://eve.dev/docs/tools/tasks): tool calls that keep running in the background while the agent carries on.
* [Workflows](https://eve.dev/docs/tools/workflows): tools with several steps that can wait for a person or hand work to another agent.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.