Skip to main content
The SDK ships ten toolset classes in jsr:@vibesjs/sdk. All implement the Toolset<TDeps> interface and can be passed in the toolsets array when constructing an Agent.
MCP-specific toolsets live in the same package and are covered below:

Summary


FunctionToolset

The simplest toolset: wraps an array of ToolDefinition objects. Use it when you have a fixed set of tools that do not need dynamic filtering.
Methods:

FilteredToolset

Wraps an inner toolset with a per-turn boolean predicate. When the predicate returns false the entire inner toolset is hidden from the model for that turn. When it returns true the full inner toolset is exposed. This is an all-or-nothing gate. For per-tool filtering, use PreparedToolset.

PreparedToolset

Wraps an inner toolset with a prepare function that runs once per turn. Unlike FilteredToolset, which hides the entire set, PreparedToolset can add, remove, or reorder individual tools.

PrefixedToolset

Adds a string prefix to every tool name in the wrapped toolset. Useful when composing two toolsets that define tools with the same name.

RenamedToolset

Renames specific tools using a { oldName: newName } mapping. Tools whose names are not in the map are passed through unchanged.

WrapperToolset

An abstract base class that intercepts every tool execution in the wrapped toolset. Subclass it and implement callTool to add cross-cutting behaviour: logging, metrics, rate limiting, argument transformation, or result transformation.
Call next(ctx, args) to invoke the underlying tool. You may modify args before forwarding or transform the return value afterward.

CombinedToolset

Merges any number of toolsets into one. Tools are collected from all members on each turn. When two toolsets expose a tool with the same name, the last one in the constructor argument list wins.

ApprovalRequiredToolset

Wraps a toolset and sets requiresApproval: true on every tool inside it. When the model calls any of these tools, the run pauses and throws ApprovalRequiredError with a DeferredToolRequests object.
See Human-in-the-Loop for the full approval workflow.

ExternalToolset

For tools whose execution happens outside the agent process — in the browser, a sandboxed environment, or a remote service. The agent is shown the tools and can call them; each call pauses the run and throws ApprovalRequiredError so the caller can execute the tool externally and return results. Uses raw JSON Schema instead of Zod for parameter validation.

MCPToolset

Wraps a single MCPClient and adapts it to the Toolset interface. Tools are fetched lazily on the first call to tools() and cached for toolCacheTtlMs milliseconds.
Methods:
See MCP Client for the full guide including MCPManager and config-file loading.

MCPManager

Manages multiple MCP server connections, connects them in parallel, and merges their tools into a single flat list. Implements Toolset directly — pass it to an agent without further wrapping.
Methods:
MCPManager and MCPToolset live in the MCP module but are re-exported from the main jsr:@vibesjs/sdk entry point alongside the other toolsets.

Toolsets

Per-turn tool resolution and composition overview

Tool Patterns

Advanced patterns: conditional tools, approval flows, sequential tools

MCP Client

Full guide to connecting MCP servers

Human-in-the-Loop

Handling ApprovalRequiredError and resuming runs