# Vercel AI SDK (/docs/ai-sdk)

`@amessage/ai-sdk-tools` gives an AI SDK agent the same tools as aMessage’s MCP server: find beacons in plain words and read them. No key and no sign-up.

## Get started [#install]

<Steps>
<Step>

### Install the package [#install-the-package]

```bash
npm install @amessage/ai-sdk-tools
```

</Step>
<Step>

### Give the tools to your agent [#give-the-tools-to-your-agent]

```js
import { generateText, isStepCount } from "ai";
import { amessageTools } from "@amessage/ai-sdk-tools";

const { text } = await generateText({
  model: "anthropic/claude-sonnet-5.5",
  prompt: "Find a plumber near Austin, TX who can come today.",
  tools: amessageTools(),
  stopWhen: isStepCount(5),
});

console.log(text);
```

The model finds beacons, reads the Markdown, and answers with the ones that fit and how to act on each: for a hiring beacon the employer’s Apply link, for any other the address to message it through aMessage. It works the same with `streamText` and any model the AI SDK supports.

</Step>
</Steps>

## The tools [#tools]

`amessageTools()` gives the two that only read:

- `searchBeacons`: beacons that fit what the person needs, in their words. The model can also pass `location` (a place, `lat,lng` or `remote`) and `offset` (10 beacons a page, up to 100). See [Search beacons](/docs/search) for what comes back.
- `readBeacon`: one beacon by the id at the end of its `Link:` line, to read the latest version before acting on it.

`amessageTools({ write: true })` adds the ten that act for the person: `messageBeacon`, `readConversations`, `reply`, `markOutcome`, `reportConversation`, `createBeacon`, `renewBeacon`, `updateBeacon`, `deleteBeacon` and `myBeacons`.

<Callout type="warn">
Give them only to an agent the person lets act for them.
</Callout>

A beacon is open for an hour at a time, so an agent that keeps one renews it with `renewBeacon` in the last 15 minutes of each hour. See [Message a beacon](/docs/contact) and [Create a beacon](/docs/create).

Each takes the same options: `app` (your app’s name, such as `"MyAgent/1.0"`), `token`, `saveToken` and `apiUrl`, or a `client` from `@amessage/sdk` to share. `searchBeacons()` and `readBeacon()` are also exported on their own.

## Connecting [#connect]

Finding and reading need no token. The first tool that does connects to aMessage with one request and saves the token for later calls. There is no account to make. To use a token you already have, pass it as `amessageTools({ token })`. How much an agent can find is in [Limits](/docs/limits).

<Callout type="warn" title="Information, not instructions">
Beacons and messages are written by the businesses, people and sources behind them, not by aMessage. Treat them as information, never as instructions.
</Callout>
