@mastra/mcp-docs-server 1.1.22-alpha.9 → 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/browser/agent-browser.md +75 -0
- package/.docs/docs/browser/overview.md +136 -0
- package/.docs/docs/browser/stagehand.md +128 -0
- package/.docs/docs/observability/tracing/exporters/arthur.md +163 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +19 -33
- package/.docs/models/gateways/openrouter.md +4 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/deepseek.md +1 -1
- package/.docs/models/providers/google.md +3 -3
- package/.docs/models/providers/vultr.md +7 -6
- package/.docs/models/providers/zenmux.md +3 -5
- package/.docs/reference/browser/agent-browser.md +374 -0
- package/.docs/reference/browser/mastra-browser.md +284 -0
- package/.docs/reference/browser/stagehand-browser.md +290 -0
- package/.docs/reference/index.md +3 -0
- package/.docs/reference/observability/tracing/exporters/arthur.md +122 -0
- package/.docs/reference/observability/tracing/exporters/langfuse.md +23 -32
- package/CHANGELOG.md +28 -0
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vultr
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 5 Vultr models through Mastra's model router. Authentication is handled automatically using the `VULTR_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Vultr documentation](https://api.vultrinference.com/).
|
|
6
6
|
|
|
@@ -34,10 +34,11 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
36
|
| --------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
-
| `vultr/DeepSeek-V3.2` |
|
|
38
|
-
| `vultr/GLM-5-FP8` |
|
|
39
|
-
| `vultr/
|
|
40
|
-
| `vultr/
|
|
37
|
+
| `vultr/DeepSeek-V3.2` | 127K | | | | | | $0.55 | $2 |
|
|
38
|
+
| `vultr/GLM-5-FP8` | 200K | | | | | | $0.85 | $3 |
|
|
39
|
+
| `vultr/gpt-oss-120b` | 129K | | | | | | $0.15 | $0.60 |
|
|
40
|
+
| `vultr/Kimi-K2.5` | 254K | | | | | | $0.55 | $3 |
|
|
41
|
+
| `vultr/MiniMax-M2.5` | 194K | | | | | | $0.30 | $1 |
|
|
41
42
|
|
|
42
43
|
## Advanced configuration
|
|
43
44
|
|
|
@@ -67,7 +68,7 @@ const agent = new Agent({
|
|
|
67
68
|
model: ({ requestContext }) => {
|
|
68
69
|
const useAdvanced = requestContext.task === "complex";
|
|
69
70
|
return useAdvanced
|
|
70
|
-
? "vultr/
|
|
71
|
+
? "vultr/gpt-oss-120b"
|
|
71
72
|
: "vultr/DeepSeek-V3.2";
|
|
72
73
|
}
|
|
73
74
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ZenMux
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 86 ZenMux models through Mastra's model router. Authentication is handled automatically using the `ZENMUX_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [ZenMux documentation](https://docs.zenmux.ai).
|
|
6
6
|
|
|
@@ -52,13 +52,10 @@ for await (const chunk of stream) {
|
|
|
52
52
|
| `zenmux/google/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 |
|
|
53
53
|
| `zenmux/google/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
|
|
54
54
|
| `zenmux/google/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
|
|
55
|
-
| `zenmux/google/gemini-3-pro-preview` | 1.0M | | | | | | $2 | $12 |
|
|
56
55
|
| `zenmux/google/gemini-3.1-flash-lite-preview` | 1.1M | | | | | | $0.25 | $2 |
|
|
57
56
|
| `zenmux/google/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
|
|
58
57
|
| `zenmux/inclusionai/ling-1t` | 128K | | | | | | $0.56 | $2 |
|
|
59
58
|
| `zenmux/inclusionai/ring-1t` | 128K | | | | | | $0.56 | $2 |
|
|
60
|
-
| `zenmux/kuaishou/kat-coder-pro-v1` | 256K | | | | | | $0.30 | $1 |
|
|
61
|
-
| `zenmux/kuaishou/kat-coder-pro-v1-free` | 256K | | | | | | — | — |
|
|
62
59
|
| `zenmux/kuaishou/kat-coder-pro-v2` | 256K | | | | | | $0.30 | $1 |
|
|
63
60
|
| `zenmux/minimax/minimax-m2` | 204K | | | | | | $0.30 | $1 |
|
|
64
61
|
| `zenmux/minimax/minimax-m2.1` | 204K | | | | | | $0.30 | $1 |
|
|
@@ -90,6 +87,8 @@ for await (const chunk of stream) {
|
|
|
90
87
|
| `zenmux/qwen/qwen3.5-flash` | 1.0M | | | | | | $0.10 | $0.40 |
|
|
91
88
|
| `zenmux/qwen/qwen3.5-plus` | 1.0M | | | | | | $0.80 | $5 |
|
|
92
89
|
| `zenmux/qwen/qwen3.6-plus` | 1.0M | | | | | | $0.50 | $3 |
|
|
90
|
+
| `zenmux/sapiens-ai/agnes-1.5-lite` | 256K | | | | | | $0.12 | $0.60 |
|
|
91
|
+
| `zenmux/sapiens-ai/agnes-1.5-pro` | 256K | | | | | | $0.16 | $0.80 |
|
|
93
92
|
| `zenmux/stepfun/step-3` | 66K | | | | | | $0.21 | $0.57 |
|
|
94
93
|
| `zenmux/stepfun/step-3.5-flash` | 256K | | | | | | $0.10 | $0.30 |
|
|
95
94
|
| `zenmux/stepfun/step-3.5-flash-free` | 256K | | | | | | — | — |
|
|
@@ -107,7 +106,6 @@ for await (const chunk of stream) {
|
|
|
107
106
|
| `zenmux/x-ai/grok-4.2-fast-non-reasoning` | 2.0M | | | | | | $3 | $9 |
|
|
108
107
|
| `zenmux/x-ai/grok-code-fast-1` | 256K | | | | | | $0.20 | $2 |
|
|
109
108
|
| `zenmux/xiaomi/mimo-v2-flash` | 262K | | | | | | $0.10 | $0.30 |
|
|
110
|
-
| `zenmux/xiaomi/mimo-v2-flash-free` | 262K | | | | | | — | — |
|
|
111
109
|
| `zenmux/xiaomi/mimo-v2-omni` | 265K | | | | | | $0.40 | $2 |
|
|
112
110
|
| `zenmux/xiaomi/mimo-v2-pro` | 1.0M | | | | | | $2 | $5 |
|
|
113
111
|
| `zenmux/z-ai/glm-4.5` | 128K | | | | | | $0.35 | $2 |
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
# AgentBrowser class
|
|
2
|
+
|
|
3
|
+
The `AgentBrowser` class provides deterministic browser automation using the [agent-browser](https://github.com/vercel-labs/agent-browser) library. It uses accessibility tree snapshots and element refs (e.g., `@e5`) for precise, reproducible interactions.
|
|
4
|
+
|
|
5
|
+
Use `AgentBrowser` when you need reliable, deterministic browser automation. For AI-powered interactions using natural language, see [`StagehandBrowser`](https://mastra.ai/reference/browser/stagehand-browser).
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Agent } from '@mastra/core/agent'
|
|
11
|
+
import { AgentBrowser } from '@mastra/agent-browser'
|
|
12
|
+
|
|
13
|
+
const browser = new AgentBrowser({
|
|
14
|
+
headless: true,
|
|
15
|
+
viewport: { width: 1280, height: 720 },
|
|
16
|
+
scope: 'thread',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const browserAgent = new Agent({
|
|
20
|
+
name: 'browser-agent',
|
|
21
|
+
instructions: `You can browse the web. Use browser_snapshot to see the page structure,
|
|
22
|
+
then interact with elements using their refs (e.g., @e5).`,
|
|
23
|
+
model: 'openai/gpt-5.4',
|
|
24
|
+
browser,
|
|
25
|
+
})
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Constructor parameters
|
|
29
|
+
|
|
30
|
+
**headless** (`boolean`): Whether to run the browser in headless mode (no visible UI). (Default: `true`)
|
|
31
|
+
|
|
32
|
+
**viewport** (`{ width: number; height: number }`): Browser viewport dimensions. (Default: `{ width: 1280, height: 720 }`)
|
|
33
|
+
|
|
34
|
+
**timeout** (`number`): Default timeout in milliseconds for browser operations. (Default: `30000`)
|
|
35
|
+
|
|
36
|
+
**cdpUrl** (`string | (() => string | Promise<string>)`): CDP WebSocket URL for connecting to an existing browser. Useful for cloud browser providers.
|
|
37
|
+
|
|
38
|
+
**scope** (`'shared' | 'thread'`): Browser instance scope. 'shared' shares one browser across all threads. 'thread' gives each thread its own browser. (Default: `'thread' (or 'shared' when cdpUrl is provided)`)
|
|
39
|
+
|
|
40
|
+
**onLaunch** (`(args: { browser: MastraBrowser }) => void | Promise<void>`): Callback invoked after the browser is ready.
|
|
41
|
+
|
|
42
|
+
**onClose** (`(args: { browser: MastraBrowser }) => void | Promise<void>`): Callback invoked before the browser closes.
|
|
43
|
+
|
|
44
|
+
**screencast** (`ScreencastOptions`): Configuration for streaming browser frames to Studio.
|
|
45
|
+
|
|
46
|
+
## Tools
|
|
47
|
+
|
|
48
|
+
`AgentBrowser` provides 15 deterministic tools for browser automation. All tools that interact with elements use refs from the accessibility tree snapshot.
|
|
49
|
+
|
|
50
|
+
### Core tools
|
|
51
|
+
|
|
52
|
+
| Tool | Description |
|
|
53
|
+
| ------------------ | ------------------------------------------------- |
|
|
54
|
+
| `browser_goto` | Navigate to a URL |
|
|
55
|
+
| `browser_snapshot` | Get accessibility tree snapshot with element refs |
|
|
56
|
+
| `browser_click` | Click an element by ref |
|
|
57
|
+
| `browser_type` | Type text into an element |
|
|
58
|
+
| `browser_press` | Press keyboard keys |
|
|
59
|
+
| `browser_select` | Select option from dropdown |
|
|
60
|
+
| `browser_scroll` | Scroll the page or element |
|
|
61
|
+
| `browser_close` | Close the browser |
|
|
62
|
+
|
|
63
|
+
### Extended tools
|
|
64
|
+
|
|
65
|
+
| Tool | Description |
|
|
66
|
+
| ------------------ | ----------------------------------------------- |
|
|
67
|
+
| `browser_hover` | Hover over an element |
|
|
68
|
+
| `browser_back` | Go back in browser history |
|
|
69
|
+
| `browser_dialog` | Handle browser dialogs (alert, confirm, prompt) |
|
|
70
|
+
| `browser_wait` | Wait for element state changes |
|
|
71
|
+
| `browser_tabs` | Manage browser tabs (list, new, switch, close) |
|
|
72
|
+
| `browser_drag` | Drag and drop elements |
|
|
73
|
+
| `browser_evaluate` | Execute JavaScript in the page (escape hatch) |
|
|
74
|
+
|
|
75
|
+
## Tool reference
|
|
76
|
+
|
|
77
|
+
### `browser_goto`
|
|
78
|
+
|
|
79
|
+
Navigate to a URL.
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
// Tool input
|
|
83
|
+
{
|
|
84
|
+
"url": "https://example.com",
|
|
85
|
+
"waitUntil": "domcontentloaded",
|
|
86
|
+
"timeout": 30000
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| Parameter | Type | Description |
|
|
91
|
+
| ----------- | ----------------------------------------------- | ----------------------------------------------- |
|
|
92
|
+
| `url` | `string` | URL to navigate to |
|
|
93
|
+
| `waitUntil` | `"load" \| "domcontentloaded" \| "networkidle"` | When to consider navigation complete (optional) |
|
|
94
|
+
| `timeout` | `number` | Navigation timeout in ms (optional) |
|
|
95
|
+
|
|
96
|
+
### `browser_snapshot`
|
|
97
|
+
|
|
98
|
+
Get an accessibility tree snapshot of the page. Returns element refs like `@e5` that you use with other tools.
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
// Tool input
|
|
102
|
+
{
|
|
103
|
+
"interactiveOnly": true,
|
|
104
|
+
"maxDepth": 10
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| Parameter | Type | Description |
|
|
109
|
+
| ----------------- | --------- | -------------------------------------------- |
|
|
110
|
+
| `interactiveOnly` | `boolean` | Only include interactive elements (optional) |
|
|
111
|
+
| `maxDepth` | `number` | Maximum tree depth (optional) |
|
|
112
|
+
|
|
113
|
+
**Example output:**
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
[document] Example Page
|
|
117
|
+
[banner]
|
|
118
|
+
[link @e1] Home
|
|
119
|
+
[link @e2] About
|
|
120
|
+
[main]
|
|
121
|
+
[heading @e3] Welcome
|
|
122
|
+
[textbox @e4] Search...
|
|
123
|
+
[button @e5] Submit
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `browser_click`
|
|
127
|
+
|
|
128
|
+
Click an element using its ref from the snapshot.
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
{
|
|
132
|
+
"ref": "@e5",
|
|
133
|
+
"button": "left",
|
|
134
|
+
"clickCount": 1,
|
|
135
|
+
"modifiers": ["Control", "Shift"]
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
| Parameter | Type | Description |
|
|
140
|
+
| ------------ | ------------------------------- | ---------------------------------------------- |
|
|
141
|
+
| `ref` | `string` | Element ref from snapshot (required) |
|
|
142
|
+
| `button` | `"left" \| "right" \| "middle"` | Mouse button (optional) |
|
|
143
|
+
| `clickCount` | `number` | Number of activations, 2 for double (optional) |
|
|
144
|
+
| `modifiers` | `string[]` | Modifier keys (optional) |
|
|
145
|
+
|
|
146
|
+
### `browser_type`
|
|
147
|
+
|
|
148
|
+
Type text into an input element.
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
// Tool input
|
|
152
|
+
{
|
|
153
|
+
"ref": "@e4",
|
|
154
|
+
"text": "search query",
|
|
155
|
+
"clear": true,
|
|
156
|
+
"delay": 50
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
| Parameter | Type | Description |
|
|
161
|
+
| --------- | --------- | ----------------------------------------- |
|
|
162
|
+
| `ref` | `string` | Element ref from snapshot (required) |
|
|
163
|
+
| `text` | `string` | Text to type (required) |
|
|
164
|
+
| `clear` | `boolean` | Clear existing content first (optional) |
|
|
165
|
+
| `delay` | `number` | Delay between keystrokes in ms (optional) |
|
|
166
|
+
|
|
167
|
+
### `browser_press`
|
|
168
|
+
|
|
169
|
+
Press keyboard keys.
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
// Tool input
|
|
173
|
+
{
|
|
174
|
+
"key": "Enter",
|
|
175
|
+
"modifiers": ["Control"]
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Key combinations
|
|
179
|
+
{ "key": "Control+a" }
|
|
180
|
+
{ "key": "Control+c" }
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
| Parameter | Type | Description |
|
|
184
|
+
| ----------- | ---------- | ----------------------------------------------------------------- |
|
|
185
|
+
| `key` | `string` | Key name (e.g., "Enter", "Tab", "Escape", "Control+a") (required) |
|
|
186
|
+
| `modifiers` | `string[]` | Modifier keys (optional) |
|
|
187
|
+
|
|
188
|
+
### `browser_select`
|
|
189
|
+
|
|
190
|
+
Select an option from a dropdown. Provide one of `value`, `label`, or `index`.
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
// Tool input - by value
|
|
194
|
+
{
|
|
195
|
+
"ref": "@e10",
|
|
196
|
+
"value": "option-value"
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Tool input - by label
|
|
200
|
+
{
|
|
201
|
+
"ref": "@e10",
|
|
202
|
+
"label": "Option Text"
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Tool input - by index
|
|
206
|
+
{
|
|
207
|
+
"ref": "@e10",
|
|
208
|
+
"index": 0
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### `browser_scroll`
|
|
213
|
+
|
|
214
|
+
Scroll the page or a specific element.
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
// Tool input
|
|
218
|
+
{
|
|
219
|
+
"direction": "down",
|
|
220
|
+
"amount": 300,
|
|
221
|
+
"ref": "@e15"
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
| Parameter | Type | Description |
|
|
226
|
+
| ----------- | ------------------------------------- | ----------------------------------------------------- |
|
|
227
|
+
| `direction` | `"up" \| "down" \| "left" \| "right"` | Scroll direction (required) |
|
|
228
|
+
| `amount` | `number` | Pixels to scroll, default 300 (optional) |
|
|
229
|
+
| `ref` | `string` | Element to scroll, scrolls page if omitted (optional) |
|
|
230
|
+
|
|
231
|
+
### `browser_hover`
|
|
232
|
+
|
|
233
|
+
Hover over an element to trigger hover effects.
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
// Tool input
|
|
237
|
+
{
|
|
238
|
+
"ref": "@e7"
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### `browser_back`
|
|
243
|
+
|
|
244
|
+
Go back in browser history.
|
|
245
|
+
|
|
246
|
+
```text
|
|
247
|
+
// Tool input (no parameters required)
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### `browser_dialog`
|
|
252
|
+
|
|
253
|
+
Handle browser dialogs (alert, confirm, prompt). Click an element that triggers a dialog and handle it.
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
// Tool input
|
|
257
|
+
{
|
|
258
|
+
"triggerRef": "@e5",
|
|
259
|
+
"action": "accept",
|
|
260
|
+
"text": "response"
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
| Parameter | Type | Description |
|
|
265
|
+
| ------------ | ----------------------- | ------------------------------------------- |
|
|
266
|
+
| `triggerRef` | `string` | Element that triggers the dialog (required) |
|
|
267
|
+
| `action` | `"accept" \| "dismiss"` | How to handle the dialog (required) |
|
|
268
|
+
| `text` | `string` | Text for prompt dialogs (optional) |
|
|
269
|
+
|
|
270
|
+
### `browser_wait`
|
|
271
|
+
|
|
272
|
+
Wait for an element to reach a specific state.
|
|
273
|
+
|
|
274
|
+
```text
|
|
275
|
+
// Tool input
|
|
276
|
+
{
|
|
277
|
+
"ref": "@e20",
|
|
278
|
+
"state": "visible",
|
|
279
|
+
"timeout": 30000
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
| Parameter | Type | Description |
|
|
284
|
+
| --------- | --------------------------------------------------- | ---------------------------------- |
|
|
285
|
+
| `ref` | `string` | Element ref to wait for (optional) |
|
|
286
|
+
| `state` | `"visible" \| "hidden" \| "attached" \| "detached"` | State to wait for (optional) |
|
|
287
|
+
| `timeout` | `number` | Max wait time in ms (optional) |
|
|
288
|
+
|
|
289
|
+
### `browser_tabs`
|
|
290
|
+
|
|
291
|
+
Manage browser tabs.
|
|
292
|
+
|
|
293
|
+
```text
|
|
294
|
+
// List all tabs
|
|
295
|
+
{ "action": "list" }
|
|
296
|
+
|
|
297
|
+
// Open new tab
|
|
298
|
+
{ "action": "new", "url": "https://example.com" }
|
|
299
|
+
|
|
300
|
+
// Switch to tab by index
|
|
301
|
+
{ "action": "switch", "index": 0 }
|
|
302
|
+
|
|
303
|
+
// Close tab by index
|
|
304
|
+
{ "action": "close", "index": 1 }
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### `browser_drag`
|
|
308
|
+
|
|
309
|
+
Drag an element to a target location.
|
|
310
|
+
|
|
311
|
+
```text
|
|
312
|
+
// Tool input
|
|
313
|
+
{
|
|
314
|
+
"sourceRef": "@e10",
|
|
315
|
+
"targetRef": "@e20"
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
| Parameter | Type | Description |
|
|
320
|
+
| ----------- | -------- | ------------------------------ |
|
|
321
|
+
| `sourceRef` | `string` | Element to drag (required) |
|
|
322
|
+
| `targetRef` | `string` | Drop target element (required) |
|
|
323
|
+
|
|
324
|
+
### `browser_evaluate`
|
|
325
|
+
|
|
326
|
+
Execute JavaScript in the page context. Use as an escape hatch when other tools don't cover your use case.
|
|
327
|
+
|
|
328
|
+
```text
|
|
329
|
+
// Tool input
|
|
330
|
+
{
|
|
331
|
+
"script": "document.title",
|
|
332
|
+
"returnValue": true
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
| Parameter | Type | Description |
|
|
337
|
+
| ------------- | --------- | --------------------------------------- |
|
|
338
|
+
| `script` | `string` | JavaScript to execute (required) |
|
|
339
|
+
| `returnValue` | `boolean` | Whether to return the result (optional) |
|
|
340
|
+
|
|
341
|
+
### `browser_close`
|
|
342
|
+
|
|
343
|
+
Close the browser and clean up resources.
|
|
344
|
+
|
|
345
|
+
```text
|
|
346
|
+
// Tool input (no parameters required)
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
## How refs work
|
|
351
|
+
|
|
352
|
+
The `browser_snapshot` tool returns an accessibility tree with element refs like `@e1`, `@e2`, etc. These refs are stable identifiers you use with other tools:
|
|
353
|
+
|
|
354
|
+
1. Call `browser_snapshot` to see the page structure
|
|
355
|
+
2. Find the element you want to interact with
|
|
356
|
+
3. Use its ref with interaction tools like `browser_type` or `browser_scroll`.
|
|
357
|
+
|
|
358
|
+
```text
|
|
359
|
+
// 1. Get snapshot
|
|
360
|
+
// Returns: [textbox @e4] Search... [link @e5] Home
|
|
361
|
+
|
|
362
|
+
// 2. Type in the search box
|
|
363
|
+
{ "tool": "browser_type", "input": { "ref": "@e4", "text": "mastra" } }
|
|
364
|
+
|
|
365
|
+
// 3. Navigate to home
|
|
366
|
+
{ "tool": "browser_goto", "input": { "url": "https://example.com" } }
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Related
|
|
370
|
+
|
|
371
|
+
- [MastraBrowser](https://mastra.ai/reference/browser/mastra-browser): Base class reference
|
|
372
|
+
- [StagehandBrowser](https://mastra.ai/reference/browser/stagehand-browser): AI-powered alternative
|
|
373
|
+
- [Browser overview](https://mastra.ai/docs/browser/overview): Conceptual guide
|
|
374
|
+
- [agent-browser guide](https://mastra.ai/docs/browser/agent-browser): Usage guide
|