@moss-tools/vercel-sdk package. This setup exposes Moss operations as AI SDK tools, so language models can search, create indexes, and manage documents as part of agentic workflows.
Note: For the full package source and tests, see the vercel-sdk package.
Why use Moss with the Vercel AI SDK?
The Vercel AI SDK’s tool system lets language models call external functions during generation. Moss tools give your agents direct access to a semantic knowledge base with sub-10ms retrieval, enabling RAG workflows and knowledge base operations within a singlegenerateText or streamText call.
Required tools
Integration guide
Available tools
Read-only
| Tool | Description |
|---|---|
mossSearchTool | Semantic search over an index. Returns matching documents ranked by similarity. |
mossListIndexesTool | List all available indexes in the Moss project. |
Mutating (requires approval)
Mutating tools haveneedsApproval: true, so the AI SDK prompts for user confirmation before execution.
| Tool | Description |
|---|---|
mossAddDocsTool | Add documents to an existing index. Supports upsert by document ID. |
mossDeleteDocsTool | Delete documents from an index by their IDs. |
mossCreateIndexTool | Create a new index with initial documents. |
Configuration
Index binding
Tools accept an optionalindexName parameter. When provided, the tool is prebound to that index and the LLM only needs to provide the query or document data. When omitted, the LLM chooses the index name dynamically.
mossSearchTool options
| Parameter | Type | Default | Description |
|---|---|---|---|
client | MossClient | Required | An initialized Moss client instance. |
indexName | string | undefined | Prebind to a specific index. |
description | string | Auto-generated | Custom tool description for the LLM. |