@mastra/mcp-docs-server 1.3.13-alpha.0 → 1.3.13-alpha.2
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/agents/resumable-streams.md +140 -0
- package/.docs/docs/agents/tools.md +2 -2
- package/.docs/docs/auth/overview.md +1 -0
- package/.docs/docs/channels.md +34 -1
- package/.docs/docs/connections/mcp.md +27 -61
- package/.docs/docs/harness/background-tasks.md +2 -1
- package/.docs/docs/harness/durable-agents.md +6 -6
- package/.docs/docs/harness/schedules.md +2 -0
- package/.docs/docs/mastra-platform/connect.md +231 -0
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/observability/tracing/overview.md +0 -2
- package/.docs/docs/signals/sending-signals.md +3 -1
- package/.docs/integrations/auth/clerk.md +46 -7
- package/.docs/integrations/auth/neon.md +217 -0
- package/.docs/integrations/auth/supabase.md +46 -7
- package/.docs/integrations/auth/workos.md +54 -15
- package/.docs/integrations/channels/discord.md +84 -6
- package/.docs/integrations/channels/github.md +63 -24
- package/.docs/integrations/channels/slack.md +89 -8
- package/.docs/integrations/channels/teams.md +79 -5
- package/.docs/integrations/channels/telegram.md +47 -6
- package/.docs/integrations/crm/attio.md +42 -0
- package/.docs/integrations/crm/clay.md +42 -0
- package/.docs/integrations/crm/hubspot.md +41 -0
- package/.docs/integrations/databases/neon.md +37 -1
- package/.docs/integrations/databases/postgresql.md +46 -0
- package/.docs/integrations/deploy/render.md +59 -18
- package/.docs/integrations/documents/google-docs.md +41 -0
- package/.docs/integrations/documents/google-sheet.md +41 -0
- package/.docs/integrations/documents/microsoft-excel.md +43 -0
- package/.docs/integrations/documents/microsoft-powerpoint.md +41 -0
- package/.docs/integrations/documents/microsoft-word.md +41 -0
- package/.docs/integrations/documents/notion.md +41 -0
- package/.docs/integrations/documents/one-drive.md +41 -0
- package/.docs/integrations/documents/sharepoint-online.md +41 -0
- package/.docs/integrations/email-calendar/google-calendar.md +41 -0
- package/.docs/integrations/email-calendar/google-mail.md +41 -0
- package/.docs/integrations/email-calendar/outlook.md +41 -0
- package/.docs/integrations/file-storage/amazon-s3.md +1 -1
- package/.docs/integrations/file-storage/google-drive.md +54 -15
- package/.docs/integrations/observability/posthog.md +50 -11
- package/.docs/integrations/other/canva.md +42 -0
- package/.docs/integrations/other/fireflies.md +41 -0
- package/.docs/integrations/other/incident-io.md +41 -0
- package/.docs/integrations/other/resend.md +43 -0
- package/.docs/integrations/other/robinhood.md +44 -0
- package/.docs/integrations/other/sanity.md +42 -0
- package/.docs/integrations/other/snowflake.md +41 -0
- package/.docs/integrations/project-management/jira.md +41 -0
- package/.docs/integrations/project-management/linear.md +41 -0
- package/.docs/integrations/voice/openai.md +40 -0
- package/.docs/integrations.md +40 -1
- package/.docs/models/gateways/custom-gateways.md +2 -0
- package/.docs/models/gateways/netlify.md +6 -3
- package/.docs/models/gateways/openrouter.md +7 -8
- package/.docs/models/gateways/vercel.md +419 -420
- package/.docs/models/index.md +46 -2
- package/.docs/models/providers/aiand.md +1 -1
- package/.docs/models/providers/chutes.md +2 -1
- package/.docs/models/providers/edenai.md +9 -13
- package/.docs/models/providers/empiriolabs.md +3 -3
- package/.docs/models/providers/hyper.md +7 -13
- package/.docs/models/providers/inceptron.md +1 -1
- package/.docs/models/providers/kilo.md +16 -16
- package/.docs/models/providers/llmgateway-providers.md +16 -8
- package/.docs/models/providers/llmgateway.md +4 -4
- package/.docs/models/providers/nano-gpt.md +12 -14
- package/.docs/models/providers/opencode-go.md +3 -1
- package/.docs/models/providers/opencode.md +2 -2
- package/.docs/models/providers/prime.md +1 -1
- package/.docs/models/providers/tencent-token-plan.md +2 -1
- package/.docs/models/providers/tencent-tokenhub.md +2 -1
- package/.docs/models/providers/wandb.md +3 -3
- package/.docs/reference/agents/agent.md +2 -0
- package/.docs/reference/agents/channels.md +38 -1
- package/.docs/reference/agents/durable-agent.md +37 -26
- package/.docs/reference/auth/neon.md +24 -15
- package/.docs/reference/cli/mastra.md +10 -1
- package/.docs/reference/client-js/agents.md +4 -4
- package/.docs/reference/client-js/observability.md +23 -1
- package/.docs/reference/connect/channels.md +55 -1
- package/.docs/reference/connect/providers.md +5 -3
- package/.docs/reference/connect/tools.md +29 -2
- package/.docs/reference/core/getGatewayById.md +14 -1
- package/.docs/reference/observability/tracing/advanced-queries.md +47 -58
- package/.docs/reference/pubsub/redis-streams.md +2 -0
- package/.docs/reference/streaming/agents/MastraModelOutput.md +6 -4
- package/.docs/reference/tools/mcp-server.md +6 -2
- package/.docs/reference/workflows/workflow.md +1 -1
- package/package.json +4 -4
- package/.docs/docs/mastra-platform/connect/channels.md +0 -165
- package/.docs/docs/mastra-platform/connect/overview.md +0 -102
- package/.docs/docs/mastra-platform/connect/providers.md +0 -66
- package/.docs/docs/mastra-platform/connect/tools.md +0 -151
|
@@ -115,7 +115,7 @@ if (capabilities.spanAggregate) {
|
|
|
115
115
|
|
|
116
116
|
The request and response structure follows `aggregateTraces()`, with direct span predicates and span dimensions such as `spanType`, `name`, and `parentEntityName`. Token and cost measures belong to the span that recorded the usage and aren't added to parent spans. Check `capabilities.spanAggregate` before calling, and `capabilities.spanAggregateModelDimensions` before grouping or counting distinct values by `model` or `provider`. With an older adapter, those requests return `501`.
|
|
117
117
|
|
|
118
|
-
Both `aggregateTraces()` and `aggregateSpans()` accept `timeToFirstToken.*` and `timeToFirstChunk
|
|
118
|
+
Both `aggregateTraces()` and `aggregateSpans()` accept time to first token (TTFT) and time to first chunk (TTFC) measures, `timeToFirstToken.*` and `timeToFirstChunk.*`, when `capabilities.aggregateTimeToFirstMeasures` is `true`. Spans and traces without a recorded value are skipped, never counted as 0. See [Time to first chunk (TTFC)](https://mastra.ai/reference/observability/tracing/advanced-queries) and [Time to first token (TTFT)](https://mastra.ai/reference/observability/tracing/advanced-queries).
|
|
119
119
|
|
|
120
120
|
See [Aggregate spans](https://mastra.ai/reference/observability/tracing/advanced-queries) for selection, dimensions, per-span usage, and how to list the spans behind a group.
|
|
121
121
|
|
|
@@ -403,6 +403,16 @@ const scores = await mastraClient.listScoresBySpan({
|
|
|
403
403
|
})
|
|
404
404
|
```
|
|
405
405
|
|
|
406
|
+
## Get a score by ID
|
|
407
|
+
|
|
408
|
+
Use `getScore()` to retrieve one observability score:
|
|
409
|
+
|
|
410
|
+
```typescript
|
|
411
|
+
const { score } = await mastraClient.getScore('score-id-123')
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
The response is `{ score: record | null }`. A missing score returns HTTP 200 with `{ score: null }`. The return type is `GetScoreResponse`, exported from `@mastra/client-js`.
|
|
415
|
+
|
|
406
416
|
## Creating scores
|
|
407
417
|
|
|
408
418
|
Create a score for a trace, optionally identifying a span within it:
|
|
@@ -424,6 +434,18 @@ const response = await mastraClient.createScore({
|
|
|
424
434
|
|
|
425
435
|
Feedback methods create, list, and query human-in-the-loop signals such as ratings, thumbs, comments, and corrections through the configured API server. Create methods support OSS and Platform. Full replacement uses Platform's PUT endpoint. See the [feedback guide](https://mastra.ai/docs/observability/feedback) for examples and the [feedback reference](https://mastra.ai/reference/observability/feedback) for full schemas.
|
|
426
436
|
|
|
437
|
+
### Get feedback by ID
|
|
438
|
+
|
|
439
|
+
Use `getFeedback()` to retrieve one feedback record:
|
|
440
|
+
|
|
441
|
+
```typescript
|
|
442
|
+
const { feedback } = await mastraClient.getFeedback('feedback-id-123')
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
The response is `{ feedback: record | null }`. A missing record returns HTTP 200 with `{ feedback: null }`. The return type is `GetFeedbackResponse`, exported from `@mastra/client-js`.
|
|
446
|
+
|
|
447
|
+
Both getters accept an unencoded ID and encode it as a URL path segment. They use the client's configured API prefix, credentials, and headers. Record timestamps are ISO strings in the JSON response.
|
|
448
|
+
|
|
427
449
|
### Creating feedback
|
|
428
450
|
|
|
429
451
|
Create a feedback record for a trace, optionally identifying a span within it:
|
|
@@ -18,7 +18,7 @@ export const mastra = new Mastra({
|
|
|
18
18
|
|
|
19
19
|
Returns: `Promise<ChannelsResolver>`. See [The resolver](#the-resolver).
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Each provider's integration page covers its channel setup: [Slack](https://mastra.ai/integrations/channels/slack), [Telegram](https://mastra.ai/integrations/channels/telegram), [Discord](https://mastra.ai/integrations/channels/discord), and [Microsoft Teams](https://mastra.ai/integrations/channels/teams). Their implementations come from `@mastra/slack`, `@mastra/telegram`, `@mastra/discord`, and `@mastra/teams`, loaded on demand. Use those packages directly to configure a channel outside the platform connection flow.
|
|
22
22
|
|
|
23
23
|
The Teams provider encrypts stored bot secrets with `MASTRA_ENCRYPTION_KEY` when set. When it isn't, the key is derived from the platform access token and a warning is logged while a Teams connection is active. Rotating the platform access token makes stored bot credentials unreadable (disconnect and reconnect to re-provision). Projects without a Teams connection are unaffected.
|
|
24
24
|
|
|
@@ -62,6 +62,60 @@ Providers without an active connection don't appear in the resolved map. Their r
|
|
|
62
62
|
|
|
63
63
|
Failure handling matches [`tools()`](https://mastra.ai/reference/connect/tools): configuration errors (missing project ID, bad `ttlMs`, an unknown or malformed provider ID, both spellings of the Slack key) reject at call time, while per-provider problems (provider construction failure, `needs_reauth`, credential sync failure) are downgraded to warn-and-skip. Several active connections for one provider aren't a skip: the resolver warns and uses the first, and `providers.<id>.connectionId` pins the choice. The initial resolution rejects if its platform fetch fails. A failed background refresh warns and preserves the cached snapshot, while an explicit `refresh()` rejects on fetch failure.
|
|
64
64
|
|
|
65
|
+
## Combine with self-managed channels
|
|
66
|
+
|
|
67
|
+
`channels()` replaces the whole `channels` option, and there is no built-in helper to merge it with providers you construct yourself. To use Connect for some channels and manage another yourself, wrap both in one resolver. The wrapper must stay callable and expose a `getRoutes()` that returns every provider's routes, because Mastra mounts channel routes once at construction:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { Mastra } from '@mastra/core'
|
|
71
|
+
import { channels } from '@mastra/connect'
|
|
72
|
+
import { TelegramProvider } from '@mastra/telegram'
|
|
73
|
+
import { assistant } from './agents/assistant'
|
|
74
|
+
|
|
75
|
+
const connectChannels = await channels({ providers: ['slack', 'discord'] })
|
|
76
|
+
const telegram = new TelegramProvider()
|
|
77
|
+
|
|
78
|
+
export const mastra = new Mastra({
|
|
79
|
+
agents: { assistant },
|
|
80
|
+
channels: Object.assign(async () => ({ ...(await connectChannels()), telegram }), {
|
|
81
|
+
getRoutes: () => [...connectChannels.getRoutes(), ...telegram.getRoutes()],
|
|
82
|
+
}),
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Exclude the self-managed channel from the Connect selection, as the array form does here. Mastra doesn't detect two providers that register the same route, so a channel enabled in both places mounts conflicting webhooks. Create the self-managed provider once, outside the wrapper: Mastra attaches each distinct provider instance only once. Configure its credentials as described in the [Telegram provider reference](https://mastra.ai/reference/channels/telegram-provider).
|
|
87
|
+
|
|
88
|
+
## Vary tools by channel
|
|
89
|
+
|
|
90
|
+
Channel messages put a [`ChannelContext`](https://mastra.ai/integrations/channels/slack) on the [request context](https://mastra.ai/docs/server/request-context) under the `channel` key. It includes the platform, whether the conversation is a direct message (`isDM`), channel and thread IDs, and the sender's user ID and name. An agent's `tools` function can read it to filter the record that [`tools()`](https://mastra.ai/reference/connect/tools) resolves:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { Agent } from '@mastra/core/agent'
|
|
94
|
+
import type { ChannelContext } from '@mastra/core/channels'
|
|
95
|
+
import { tools } from '@mastra/connect'
|
|
96
|
+
|
|
97
|
+
const connectTools = tools({ providers: ['linear'] })
|
|
98
|
+
const readTools = new Set(['linear_list_issues'])
|
|
99
|
+
|
|
100
|
+
export const assistant = new Agent({
|
|
101
|
+
id: 'assistant',
|
|
102
|
+
name: 'assistant',
|
|
103
|
+
instructions: 'You help the team track work in Linear from Slack and Discord.',
|
|
104
|
+
model: 'openai/gpt-6-luna',
|
|
105
|
+
tools: async ctx => {
|
|
106
|
+
const channel = ctx.requestContext?.get('channel') as ChannelContext | undefined
|
|
107
|
+
const all = await connectTools(ctx)
|
|
108
|
+
|
|
109
|
+
if (channel?.isDM && ctx.requestContext?.get('role') === 'operator') {
|
|
110
|
+
return all
|
|
111
|
+
}
|
|
112
|
+
return Object.fromEntries(Object.entries(all).filter(([key]) => readTools.has(key)))
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Here, only direct messages from users your application identifies as operators get the full Linear toolset. Other requests get only `linear_list_issues`. Set `role` in trusted server-side code after you verify the sender's identity and permissions. Don't grant write access based on conversation type alone. To filter by options instead of post-processing, see [per-request options](https://mastra.ai/reference/connect/tools).
|
|
118
|
+
|
|
65
119
|
## Discord permissions
|
|
66
120
|
|
|
67
121
|
The Discord bot-invite URL requests the `bot` and `applications.commands` scopes with these permissions:
|
|
@@ -8,7 +8,7 @@ This page documents generated toolsets for 28 providers (1076 tools in this vers
|
|
|
8
8
|
|
|
9
9
|
Tool keys are stable identifiers of the form `<provider>_<action>` and are the values accepted by `allowTools` and `disallowTools`. Toolsets are versioned with the package: the exact list depends on the installed `@mastra/connect` version, and this page reflects the version it was generated from.
|
|
10
10
|
|
|
11
|
-
MCP providers (Attio, Canva, Clay, Neon, Render, Robinhood, and Sanity) serve their tools from their hosted MCP servers at runtime and aren't listed here. See [MCP providers](https://mastra.ai/
|
|
11
|
+
MCP providers ([Attio](https://mastra.ai/integrations/crm/attio), [Canva](https://mastra.ai/integrations/other/canva), [Clay](https://mastra.ai/integrations/crm/clay), [Neon](https://mastra.ai/integrations/databases/neon), [Render](https://mastra.ai/integrations/deploy/render), [Robinhood](https://mastra.ai/integrations/other/robinhood), and [Sanity](https://mastra.ai/integrations/other/sanity)) serve their tools from their hosted MCP servers at runtime and aren't listed here. See [MCP providers](https://mastra.ai/reference/connect/tools) for how `tools()` discovers them.
|
|
12
12
|
|
|
13
13
|
| Provider | Provider ID | Tools |
|
|
14
14
|
| ----------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- |
|
|
@@ -30,9 +30,9 @@ MCP providers (Attio, Canva, Clay, Neon, Render, Robinhood, and Sanity) serve th
|
|
|
30
30
|
|  [Microsoft Teams](#microsoft-teams) | `microsoft-teams` | 25 |
|
|
31
31
|
|  [Microsoft Word](#microsoft-word) | `microsoft-word` | 18 |
|
|
32
32
|
|  [Notion](#notion) | `notion` | 44 |
|
|
33
|
-
| [OneDrive](#onedrive)
|
|
33
|
+
|  [OneDrive](#onedrive) | `one-drive` | 20 |
|
|
34
34
|
|  [OpenAI](#openai) | `openai` | 26 |
|
|
35
|
-
|  [Microsoft Outlook](#microsoft-outlook) | `outlook` | 30 |
|
|
36
36
|
|  [PostHog](#posthog) | `posthog` | 67 |
|
|
37
37
|
|  [Resend](#resend) | `resend` | 80 |
|
|
38
38
|
|  [SharePoint Online](#sharepoint-online) | `sharepoint-online` | 53 |
|
|
@@ -1010,6 +1010,8 @@ Provider ID: `posthog` · 67 tools
|
|
|
1010
1010
|
|
|
1011
1011
|
Provider ID: `resend` · 80 tools
|
|
1012
1012
|
|
|
1013
|
+
> **Note:** Connect Resend with an API key that has **Full access** permission. A **Sending access** key fails to connect because Mastra checks a new key by listing your domains, which sending access keys can't do.
|
|
1014
|
+
|
|
1013
1015
|
| Tool | Description |
|
|
1014
1016
|
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1015
1017
|
| `resend_add_contact_to_segment` | Add a contact to a segment in Resend. |
|
|
@@ -21,7 +21,7 @@ export const opsAgent = new Agent({
|
|
|
21
21
|
|
|
22
22
|
Returns: `ToolsResolver`, a resolver producing a flat tool record keyed by tool key (for example `linear_create_issue`). See [The resolver](#the-resolver).
|
|
23
23
|
|
|
24
|
-
See [Connect](https://mastra.ai/docs/mastra-platform/connect
|
|
24
|
+
See [Connect](https://mastra.ai/docs/mastra-platform/connect) to get started.
|
|
25
25
|
|
|
26
26
|
## Parameters
|
|
27
27
|
|
|
@@ -108,7 +108,34 @@ The resolver also exposes methods for manual control:
|
|
|
108
108
|
|
|
109
109
|
- `refresh()` fetches from the platform immediately, then updates the cache and returns the tool record. Rejects if the platform fetch fails.
|
|
110
110
|
- `disconnect()` clears the cached snapshots and closes the MCP transports of the state behind this resolver. Resolvers created with identical options share that state, so this disconnects them too. A later resolution rebuilds the state, and already-returned MCP tools reconnect on their next call.
|
|
111
|
-
- `with(extra)` returns a new resolver that merges extra tools into every resolution, giving extras priority on key collision. It accepts a static tool record or a function (sync or async) and calls chain. For the same merge using a spread of the resolver's result in a `tools` callback, see [
|
|
111
|
+
- `with(extra)` returns a new resolver that merges extra tools into every resolution, giving extras priority on key collision. It accepts a static tool record or a function (sync or async) and calls chain. For the same merge using a spread of the resolver's result in a `tools` callback, see [Add tools to an agent](https://mastra.ai/docs/mastra-platform/connect).
|
|
112
|
+
|
|
113
|
+
To filter on something other than tool keys, or on data that options can't express, post-process the resolved record in the agent's `tools` function. Create the resolver once, outside the function, so its cache is shared:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
import { Agent } from '@mastra/core/agent'
|
|
117
|
+
import { tools } from '@mastra/connect'
|
|
118
|
+
|
|
119
|
+
const connectTools = tools({ providers: ['linear'] })
|
|
120
|
+
const viewerTools = new Set(['linear_list_issues'])
|
|
121
|
+
|
|
122
|
+
export const opsAgent = new Agent({
|
|
123
|
+
id: 'ops',
|
|
124
|
+
name: 'ops',
|
|
125
|
+
instructions: 'You help the team track work in Linear.',
|
|
126
|
+
model: 'openai/gpt-6-luna',
|
|
127
|
+
tools: async ctx => {
|
|
128
|
+
const all = await connectTools(ctx)
|
|
129
|
+
|
|
130
|
+
if (ctx.requestContext?.get('role') === 'admin') {
|
|
131
|
+
return all
|
|
132
|
+
}
|
|
133
|
+
return Object.fromEntries(Object.entries(all).filter(([key]) => viewerTools.has(key)))
|
|
134
|
+
},
|
|
135
|
+
})
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Only the `admin` role gets every tool. Any other or missing role gets the viewer subset. Set `role` in trusted server-side code based on the authenticated user. [Vary tools by channel](https://mastra.ai/reference/connect/channels) applies the same pattern to channel messages.
|
|
112
139
|
|
|
113
140
|
Error handling depends on the cause:
|
|
114
141
|
|
|
@@ -34,7 +34,20 @@ console.log(gateway.name) // 'My Custom Gateway'
|
|
|
34
34
|
|
|
35
35
|
## Returns
|
|
36
36
|
|
|
37
|
-
**gateway** (`
|
|
37
|
+
**gateway** (`MastraModelGatewayInterface`): The gateway instance
|
|
38
|
+
|
|
39
|
+
## Throws
|
|
40
|
+
|
|
41
|
+
Throws a `MastraError` with ID `MASTRA_GET_GATEWAY_BY_ID_NOT_FOUND` if no registered gateway has the specified ID. Wrap the call in `try`/`catch` when the gateway might not be registered:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
let gateway
|
|
45
|
+
try {
|
|
46
|
+
gateway = mastra.getGatewayById('my-custom-gateway')
|
|
47
|
+
} catch {
|
|
48
|
+
// Gateway is not registered
|
|
49
|
+
}
|
|
50
|
+
```
|
|
38
51
|
|
|
39
52
|
## Related
|
|
40
53
|
|
|
@@ -128,39 +128,9 @@ This top-level predicate doesn't inspect child spans. In contrast, `spans.some`
|
|
|
128
128
|
|
|
129
129
|
Trace queries exclude incomplete roots before evaluating predicates. As a result, `{ op: 'notExists', path: 'durationMs' }` doesn't find running traces or malformed roots without a usable `endedAt`.
|
|
130
130
|
|
|
131
|
-
#### Filter by time to first chunk
|
|
131
|
+
#### Filter and sort by time to first chunk or token
|
|
132
132
|
|
|
133
|
-
`timeToFirstChunkMs`
|
|
134
|
-
|
|
135
|
-
This predicate finds traces with a model call that took more than 2 seconds to stream its first chunk:
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
const slowFirstChunk = {
|
|
139
|
-
spans: {
|
|
140
|
-
some: {
|
|
141
|
-
op: 'and',
|
|
142
|
-
args: [
|
|
143
|
-
{ op: 'eq', left: { path: 'spanType' }, right: { literal: 'model_generation' } },
|
|
144
|
-
{ op: 'gt', left: { path: 'timeToFirstChunkMs' }, right: { literal: 2000 } },
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
The value is `null` when the span didn't stream a chunk, for example a tool call or a workflow run. A `null` value counts as missing, so it matches `notExists` and never matches ordered predicates. A value of `0` isn't missing. It means the first chunk arrived in the same millisecond the span started.
|
|
152
|
-
|
|
153
|
-
Trace query results include the root span's `timeToFirstChunkMs`, and `querySpans()` results include each span's value. Stores advertise support through the `trace-query-time-to-first-chunk` feature, and the server reports it as the `traceQueryTimeToFirstChunk` capability. Against an older store, results omit the field, a predicate on it returns `501` before storage runs, and field discovery omits it.
|
|
154
|
-
|
|
155
|
-
#### Sort by time to first chunk
|
|
156
|
-
|
|
157
|
-
Pass `orderBy: [{ field: 'timeToFirstChunkMs', direction: 'desc' }]` to list the slowest first chunks first. Traces sort by the root span's value. Missing values sort last in both directions, and `0` sorts as a value. Ties break by `traceId` for traces and by span identity for `querySpans()`.
|
|
158
|
-
|
|
159
|
-
Stores advertise the sort through the `trace-query-time-to-first-chunk-sort` feature, and the server reports it as the `traceQueryTimeToFirstChunkSort` capability. Against an older store, the sort returns `501` before storage runs.
|
|
160
|
-
|
|
161
|
-
#### Filter and sort by time to first token
|
|
162
|
-
|
|
163
|
-
`timeToFirstTokenMs` is the time in milliseconds from the start of a model call, the provider request itself, to the first chunk that call streams. It leaves out the work Mastra does before calling the model, such as input processors. The value is measured once, on the model inference span that streamed the chunk. Model step, model generation, and agent run spans carry the value of the nearest such inference below them: each step takes its own, and the generation and agent run take the first step's. A step can run more than one inference, for example a fallback model or a retry that opens a new inference span. The value then comes from the first inference that streamed a chunk. A fallback attempt that failed ends its inference span with its error. That span has a value only if it streamed a chunk first. Mastra storage keeps the value in its own column and leaves it out of the stored `attributes`. Read it from the span's `timeToFirstTokenMs` field. When an in-process agent retries a failed model call, the AI SDK retries inside a single inference span. The value then includes the failed attempt and the retry wait. Durable agents open one inference span per attempt and don't. At trace scope, the field reads the current root span's value. Inside `spans.some` or `spans.none`, it reads each related span.
|
|
133
|
+
`timeToFirstChunkMs` holds a span's [time to first chunk (TTFC)](#time-to-first-chunk-ttfc), and `timeToFirstTokenMs` holds its [time to first token (TTFT)](#time-to-first-token-ttft). At trace scope, the fields read the root span's value. Inside `spans.some` or `spans.none`, they read each related span. Both fields also work in `orderBy`.
|
|
164
134
|
|
|
165
135
|
This predicate finds traces whose root agent waited more than 2 seconds for the model's first token:
|
|
166
136
|
|
|
@@ -168,9 +138,7 @@ This predicate finds traces whose root agent waited more than 2 seconds for the
|
|
|
168
138
|
const slowFirstToken = { op: 'gt', left: { path: 'timeToFirstTokenMs' }, right: { literal: 2000 } }
|
|
169
139
|
```
|
|
170
140
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
Stores advertise support through the `trace-query-time-to-first-token` feature and the sort through the `trace-query-time-to-first-token-sort` feature. The server reports them as the `traceQueryTimeToFirstToken` and `traceQueryTimeToFirstTokenSort` capabilities. Against an older store, results omit the field, and a predicate or sort on it returns `501` before storage runs.
|
|
141
|
+
See [Missing first chunk and token values](#missing-first-chunk-and-token-values) for `null`, `0`, and the capabilities each use needs.
|
|
174
142
|
|
|
175
143
|
#### Filter by outcome
|
|
176
144
|
|
|
@@ -570,7 +538,7 @@ A query using keyset pagination returns lightweight completed traces and a curso
|
|
|
570
538
|
|
|
571
539
|
The response includes `name`, `createdAt`, identity fields, `metadata`, and input/output/error previews. Supported nullable fields remain present with `null` when no value was recorded. Fields that require an optional store feature are omitted when the store lacks that feature. Previews summarize payloads; retrieve the full trace for complete input, output, and error details.
|
|
572
540
|
|
|
573
|
-
`timeToFirstChunkMs` and `timeToFirstTokenMs` are present only when the configured store supports them. See [Filter
|
|
541
|
+
`timeToFirstChunkMs` and `timeToFirstTokenMs` are present only when the configured store supports them. See [Filter and sort by time to first chunk or token](#filter-and-sort-by-time-to-first-chunk-or-token). `outcome`, `stopReason`, and `stopReasonContext` read the root span and are present only when the store supports the `traceQueryOutcomeFields` capability. They're `null` when the root span didn't record them. See [Filter by outcome](#filter-by-outcome).
|
|
574
542
|
|
|
575
543
|
The response doesn't include the related spans that matched the predicate. Use [`getTrace()`](https://mastra.ai/reference/client-js/observability) to load the full trace after selecting a result.
|
|
576
544
|
|
|
@@ -838,6 +806,12 @@ Every dimension except `executionSource` is also a trace-scope `where` field, so
|
|
|
838
806
|
| `countDistinct.<field>` | Number of distinct non-null values of a dimension or `traceId`, such as `countDistinct.userId`. |
|
|
839
807
|
| `duration.avg`, `duration.min`, `duration.max` | Root span duration in milliseconds. |
|
|
840
808
|
| `duration.p50`, `duration.p90`, `duration.p95`, `duration.p99` | Root span duration percentile in milliseconds. Percentiles can be approximate, depending on the store. |
|
|
809
|
+
| `timeToFirstChunk.avg`, `timeToFirstChunk.min`, `timeToFirstChunk.max` | Root span time to first chunk in milliseconds. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
810
|
+
| `timeToFirstChunk.p50`, `timeToFirstChunk.p90`, `timeToFirstChunk.p95`, `timeToFirstChunk.p99` | Root span time to first chunk percentile in milliseconds. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
811
|
+
| `timeToFirstChunk.count` | Number of traces whose root span recorded a time to first chunk. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
812
|
+
| `timeToFirstToken.avg`, `timeToFirstToken.min`, `timeToFirstToken.max` | Root span time to first token in milliseconds. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
813
|
+
| `timeToFirstToken.p50`, `timeToFirstToken.p90`, `timeToFirstToken.p95`, `timeToFirstToken.p99` | Root span time to first token percentile in milliseconds. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
814
|
+
| `timeToFirstToken.count` | Number of traces whose root span recorded a time to first token. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
841
815
|
| `errorCount` | Number of traces whose root span recorded an error. |
|
|
842
816
|
| `errorRate` | `errorCount` divided by `count`, from 0 to 1. |
|
|
843
817
|
| `tokens.input.sum`, `tokens.input.avg` | Input tokens. |
|
|
@@ -846,12 +820,6 @@ Every dimension except `executionSource` is also a trace-scope `where` field, so
|
|
|
846
820
|
| `tokens.reasoning.sum`, `tokens.reasoning.avg` | Reasoning output tokens. |
|
|
847
821
|
| `tokens.cached.sum`, `tokens.cached.avg` | Input tokens read from the provider's cache. |
|
|
848
822
|
| `cost.sum`, `cost.avg` | Estimated model cost. |
|
|
849
|
-
| `timeToFirstToken.avg`, `timeToFirstToken.min`, `timeToFirstToken.max` | Root span time to first token in milliseconds. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
850
|
-
| `timeToFirstToken.p50`, `timeToFirstToken.p90`, `timeToFirstToken.p95`, `timeToFirstToken.p99` | Root span time to first token percentile in milliseconds. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
851
|
-
| `timeToFirstToken.count` | Number of traces whose root span recorded a time to first token. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
852
|
-
| `timeToFirstChunk.avg`, `timeToFirstChunk.min`, `timeToFirstChunk.max` | Root span time to first chunk in milliseconds. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
853
|
-
| `timeToFirstChunk.p50`, `timeToFirstChunk.p90`, `timeToFirstChunk.p95`, `timeToFirstChunk.p99` | Root span time to first chunk percentile in milliseconds. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
854
|
-
| `timeToFirstChunk.count` | Number of traces whose root span recorded a time to first chunk. Requires the `aggregateTimeToFirstMeasures` capability. |
|
|
855
823
|
|
|
856
824
|
Numeric measures over metadata aren't supported.
|
|
857
825
|
|
|
@@ -872,16 +840,11 @@ When you request any `cost.*` measure, every row also includes a `cost` object:
|
|
|
872
840
|
|
|
873
841
|
`cost.sum` and `cost.avg` are `null` when the group has no priced traces or `unit` is `'mixed'`. A coverage below 1 means the cost understates the group's spend. The `cost` object isn't a measure, so `having` and `orderBy` can't reference it.
|
|
874
842
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
`timeToFirstToken.*` and `timeToFirstChunk.*` read the root span's `timeToFirstTokenMs` and `timeToFirstChunkMs`, the same values [`queryTraces()`](#query-traces) returns. An agent run copies them from the first model generation of its own loop:
|
|
878
|
-
|
|
879
|
-
- `timeToFirstChunk.*` is measured from the agent run's start, so it includes work done before the first model call, such as input processors and memory recall.
|
|
880
|
-
- `timeToFirstToken.*` is the time to first token of the model call that streamed that first chunk.
|
|
843
|
+
### Time to first chunk (TTFC)
|
|
881
844
|
|
|
882
|
-
|
|
845
|
+
Time to first chunk (TTFC) is how long a caller waits for the first streamed chunk. `timeToFirstChunkMs` is the time from a span's start to the first chunk of its model response. Agent run and model spans record it when the model streams a response. On an agent run, it's measured from the run's start and includes work done before the first model call, such as input processors and memory recall.
|
|
883
846
|
|
|
884
|
-
|
|
847
|
+
The `timeToFirstChunk.*` measures aggregate the root span's `timeToFirstChunkMs`, the same value [`queryTraces()`](#query-traces) returns. To filter or sort by it, see [Filter and sort by time to first chunk or token](#filter-and-sort-by-time-to-first-chunk-or-token).
|
|
885
848
|
|
|
886
849
|
```typescript
|
|
887
850
|
const { capabilities } = await mastraClient.getObservabilityCapabilities()
|
|
@@ -900,6 +863,39 @@ if (capabilities.traceAggregate && capabilities.aggregateTimeToFirstMeasures) {
|
|
|
900
863
|
}
|
|
901
864
|
```
|
|
902
865
|
|
|
866
|
+
### Time to first token (TTFT)
|
|
867
|
+
|
|
868
|
+
Time to first token (TTFT) is the time in milliseconds from the start of a model call, the provider request itself, to the first chunk that call streams. Unlike TTFC, it leaves out the work Mastra does before calling the model, such as input processors.
|
|
869
|
+
|
|
870
|
+
The `timeToFirstToken.*` measures aggregate the root span's `timeToFirstTokenMs`. To filter or sort by it, see [Filter and sort by time to first chunk or token](#filter-and-sort-by-time-to-first-chunk-or-token). Compare TTFC with TTFT to see how much of an agent's wait comes from work before the model call.
|
|
871
|
+
|
|
872
|
+
### First chunk and token span types
|
|
873
|
+
|
|
874
|
+
These span types record TTFC and TTFT:
|
|
875
|
+
|
|
876
|
+
- `model_inference`: each provider call.
|
|
877
|
+
- `model_step`: each step of a generation, with the values of the inference that streamed the step's first chunk.
|
|
878
|
+
- `model_generation`: the whole generation, with the values of its first streamed inference only. A multi-step generation, such as a tool loop, reports only its first call.
|
|
879
|
+
- `agent_run`: the agent run, with the values of the first model generation of its own loop. Its TTFC is measured from the run's start.
|
|
880
|
+
|
|
881
|
+
Other spans, such as tool calls and workflow runs, record neither value. A trace rooted in a workflow has no TTFC or TTFT at trace scope.
|
|
882
|
+
|
|
883
|
+
TTFT is measured once, on the `model_inference` span that streamed the chunk. A step with a fallback model or a retry takes the value of its first inference that streamed a chunk. A failed fallback attempt has a value only if it streamed a chunk before failing. An in-process agent retries a failed model call inside a single inference span. Its TTFT then includes the failed attempt and the retry wait. Durable agents open one inference span per attempt.
|
|
884
|
+
|
|
885
|
+
Mastra storage keeps TTFT in its own column, not in the stored `attributes`. Read it from the span's `timeToFirstTokenMs` field.
|
|
886
|
+
|
|
887
|
+
### Missing first chunk and token values
|
|
888
|
+
|
|
889
|
+
The value is `null` when the span didn't stream a chunk. A value of `0` isn't missing. It means the first chunk arrived in the same millisecond the span started.
|
|
890
|
+
|
|
891
|
+
- In predicates, `null` counts as missing. It matches `notExists` and never matches ordered predicates.
|
|
892
|
+
- In `orderBy`, missing values sort last in both directions, and `0` sorts as a value.
|
|
893
|
+
- In aggregates, spans and traces without a value are skipped, never counted as 0.
|
|
894
|
+
|
|
895
|
+
Filtering, sorting, and aggregating each require a store feature. See [Check capabilities](#check-capabilities) for the `traceQueryTimeToFirstChunk`, `traceQueryTimeToFirstChunkSort`, `traceQueryTimeToFirstToken`, `traceQueryTimeToFirstTokenSort`, and `aggregateTimeToFirstMeasures` flags. Against an older store, results omit the unsupported fields, a request that uses them returns `501` before storage runs, and [field discovery](#discover-fields-and-values) omits them.
|
|
896
|
+
|
|
897
|
+
For `timeToFirstChunk.*` and `timeToFirstToken.*`, `avg`, `min`, `max`, and the percentiles are `null` for a group where no trace has a value, and `.count` is the number of traces that do have one. Percentiles can be approximate, depending on the store. The measures require the `aggregateTimeToFirstMeasures` capability.
|
|
898
|
+
|
|
903
899
|
### Filter and order groups
|
|
904
900
|
|
|
905
901
|
A group is one distinct combination of `groupBy` values. `having`, `orderBy`, and `limit` operate on groups and use each group's measures over the whole time range, even when `interval` is set. The server applies `having` first, then orders the remaining groups and keeps the first `limit`. `truncated` is `true` when more groups remained than `limit`.
|
|
@@ -1031,14 +1027,7 @@ Aggregation uses the same span predicates as [`querySpans()`](#query-spans), wit
|
|
|
1031
1027
|
|
|
1032
1028
|
`count` counts selected spans in each group or time bucket. Buckets use each span's `startedAt`. `duration.*` measures read the span's own duration, and `errorCount` and `errorRate` read whether the span itself recorded an error.
|
|
1033
1029
|
|
|
1034
|
-
`timeToFirstToken.*` and `timeToFirstChunk.*` read the span's own `timeToFirstTokenMs` and `timeToFirstChunkMs
|
|
1035
|
-
|
|
1036
|
-
- `model_inference`: each provider call. Filter to this type for per-call time to first token.
|
|
1037
|
-
- `model_step`: each step of a generation, with the values of the inference that streamed the step's first chunk.
|
|
1038
|
-
- `model_generation`: the whole generation, with the values of its first streamed inference only. A multi-step generation, such as a tool loop, reports only its first call.
|
|
1039
|
-
- `agent_run`: the agent run, with time to first chunk measured from the run's start. Filter to this type for latency as the caller of each agent sees it.
|
|
1040
|
-
|
|
1041
|
-
Without a `spanType` filter, one agent call contributes its agent run, its model generation, and every model step and model inference.
|
|
1030
|
+
`timeToFirstToken.*` and `timeToFirstChunk.*` read the span's own `timeToFirstTokenMs` and `timeToFirstChunkMs`. See [First chunk and token span types](#first-chunk-and-token-span-types) for which spans record them. Filter to `model_inference` for per-call TTFT, or to `agent_run` for latency as the caller of each agent sees it. Without a `spanType` filter, one agent call contributes its agent run, its model generation, and every model step and model inference.
|
|
1042
1031
|
|
|
1043
1032
|
On ClickHouse, a direct `spanType` `eq` or `in` predicate, or one immediately inside an `and`, can select the smaller branch table. All selected types must be branch types: `agent_run`, `workflow_run`, `processor_run`, `scorer_run`, `rag_ingestion`, `tool_call`, or `mcp_tool_call`. Every requested field must be available in that table. An equivalent `or` predicate doesn't select this optimization. The branch path can differ from `querySpans()`:
|
|
1044
1033
|
|
|
@@ -111,6 +111,8 @@ const pubsub = new RedisStreamsPubSub({
|
|
|
111
111
|
|
|
112
112
|
**inFlightTimeoutMs** (`number`): How long a handler may hold an event without acking or nacking before the reclaim loop nacks it on its behalf. The event is republished with an incremented deliveryAttempt, so maxDeliveryAttempts still applies. Set this to recover hung handlers in single-consumer groups. 0 disables it. (Default: `0`)
|
|
113
113
|
|
|
114
|
+
**publishRetryBudgetMs** (`number`): How long, in milliseconds, publish keeps retrying a write that failed with a transient connection error, such as a closed socket, ECONNRESET, or Redis answering LOADING after a restart. When the budget runs out, publish rejects with PublishRetryBudgetExhaustedError instead of hanging. PublishRetryBudgetExhaustedError is exported from @mastra/redis-streams. (Default: `120000`)
|
|
115
|
+
|
|
114
116
|
**logger** (`{ debug?: Function; warn?: Function }`): Optional logger for diagnostics. When omitted, suppressed errors are silent.
|
|
115
117
|
|
|
116
118
|
## Properties
|
|
@@ -39,9 +39,9 @@ These properties resolve to final values after the stream completes:
|
|
|
39
39
|
|
|
40
40
|
**object.InferSchemaOutput** (`OUTPUT`): Fully typed object matching the exact schema definition
|
|
41
41
|
|
|
42
|
-
**reasoning** (`Promise<
|
|
42
|
+
**reasoning** (`Promise<ReasoningChunk[]>`): Reasoning parts for models that support reasoning (like OpenAI's o1 series). Resolves to an empty array for models without reasoning capability. Use 'reasoningText' for the reasoning as a single string.
|
|
43
43
|
|
|
44
|
-
**reasoningText** (`Promise<string | undefined>`):
|
|
44
|
+
**reasoningText** (`Promise<string | undefined>`): Complete reasoning text, joined from all reasoning parts. Resolves to undefined for models that don't produce reasoning.
|
|
45
45
|
|
|
46
46
|
**toolCalls** (`Promise<ToolCallChunk[]>`): Array of all tool call chunks made during execution. Each chunk contains tool metadata and execution details.
|
|
47
47
|
|
|
@@ -117,7 +117,9 @@ These properties resolve to final values after the stream completes:
|
|
|
117
117
|
|
|
118
118
|
**getFullOutput.usage** (`Record<string, number>`): Token usage statistics
|
|
119
119
|
|
|
120
|
-
**getFullOutput.reasoning** (`
|
|
120
|
+
**getFullOutput.reasoning** (`ReasoningChunk[]`): Reasoning parts. Empty array if the model produced no reasoning
|
|
121
|
+
|
|
122
|
+
**getFullOutput.reasoningText** (`string`): Combined reasoning text if available
|
|
121
123
|
|
|
122
124
|
**getFullOutput.finishReason** (`string`): Why generation finished
|
|
123
125
|
|
|
@@ -192,7 +194,7 @@ const output = await stream.getFullOutput()
|
|
|
192
194
|
console.log({
|
|
193
195
|
text: output.text,
|
|
194
196
|
usage: output.usage,
|
|
195
|
-
|
|
197
|
+
reasoningText: output.reasoningText,
|
|
196
198
|
finishReason: output.finishReason,
|
|
197
199
|
})
|
|
198
200
|
```
|
|
@@ -625,6 +625,8 @@ export type MCPServerResourceContent = { text?: string } | { blob?: string }
|
|
|
625
625
|
|
|
626
626
|
Every callback receives `extra`, the same protocol context tools see as `context.mcp.extra` (cancellation `signal`, `requestId`, `authInfo`, `_meta`), and `requestContext`, the trusted application context that carries `authInfo` and the user mapped by `mapAuthInfoToUser`. Use them to scope what a caller can list and read.
|
|
627
627
|
|
|
628
|
+
A `resources/read` request resolves its URI against `listResources` first. When no listed resource matches, the URI is matched against the caller's `resourceTemplates`, and `getResourceContent` receives the expanded URI. Optional expressions such as `{?format}` or `{/section}` may be left out of the URI. Variable values must be percent-encoded as RFC 6570 expansion produces them, so `file://data?format=a/b` doesn't match `file://data{?format}`. The response uses the `mimeType` and `_meta` of the matching resource or template. A URI that matches neither fails with `Resource not found`.
|
|
629
|
+
|
|
628
630
|
`getResourceContent` also receives `suspend`, `resumeData` and `suspendPayload` (the `MCPServerRequest` members). Declare `resumeSchema` to make `suspend` usable. It works exactly as it does for tools.
|
|
629
631
|
|
|
630
632
|
Example:
|
|
@@ -640,11 +642,13 @@ import type {
|
|
|
640
642
|
|
|
641
643
|
// Resources/resource templates will generally be dynamically fetched.
|
|
642
644
|
const myResources: Resource[] = [
|
|
643
|
-
{ uri: 'file://data/
|
|
645
|
+
{ uri: 'file://data/readme', name: 'Readme', mimeType: 'text/plain' },
|
|
644
646
|
]
|
|
645
647
|
|
|
646
648
|
const myResourceContents: Record<string, MCPServerResourceContent> = {
|
|
647
|
-
'file://data
|
|
649
|
+
'file://data/readme': { text: 'Read this first.' },
|
|
650
|
+
// Not listed; readable as an expansion of the `file://data/{id}` template
|
|
651
|
+
'file://data/123': { text: 'This is the content of data file 123.' },
|
|
648
652
|
}
|
|
649
653
|
|
|
650
654
|
const myResourceTemplates: ResourceTemplate[] = [
|
|
@@ -131,7 +131,7 @@ export const testWorkflow = createWorkflow({
|
|
|
131
131
|
|
|
132
132
|
**options.pruneSnapshot** (`(params: { snapshot: WorkflowRunState; workflowStatus: WorkflowRunStatus }) => WorkflowRunState`): Optional hook to transform the workflow snapshot immediately before it is persisted. Must return JSON-serializable data and preserve everything the workflow needs to resume (suspended step suspendPayloads, suspendedPaths, executionPath, etc.). Used internally by agent runs to keep snapshots minimal; user workflows persist full snapshots by default.
|
|
133
133
|
|
|
134
|
-
**options.storageVersion** (`1 | 2`): Experimental. How runs of this workflow are stored. 1 rewrites the whole run on every save. 2 saves only what changed at each step, which cuts storage writes for long workflows and loops. Version 2 requires the default execution engine and a storage adapter that supports it: in-memory, @mastra/pg, or @mastra/libsql. Creating a run on another adapter throws. It can't be combined with pruneSnapshot. Inside a version 2 run, read earlier steps with await getStepResultAsync(step) instead of getStepResult(step), and a shouldPersistSnapshot predicate sees earlier successful steps without their output. Workflow state is stored as JSON, so values such as Date are read back as strings.
|
|
134
|
+
**options.storageVersion** (`1 | 2`): Experimental. How runs of this workflow are stored. 1 rewrites the whole run on every save. 2 saves only what changed at each step, which cuts storage writes for long workflows and loops. Version 2 requires the default execution engine and a storage adapter that supports it: in-memory, @mastra/pg, or @mastra/libsql. Creating a run on another adapter throws. It can't be combined with pruneSnapshot. Inside a version 2 run, read earlier steps with await getStepResultAsync(step) instead of getStepResult(step), and a shouldPersistSnapshot predicate sees earlier successful steps without their output. Workflow state is stored as JSON, so values such as Date are read back as strings. A run keeps the version it was stored with, so a run resumed after changing this option continues in that version. A nested workflow's runs use their parent run's version, so this option applies only when the workflow runs on its own.
|
|
135
135
|
|
|
136
136
|
**options.onStart** (`(info: WorkflowStartCallbackInfo) => void | Promise<void>`): Callback awaited before a run starts executing, and before any step runs. Fires only on initial start, not on resume, restart, or time travel. Unlike onFinish and onError, errors thrown here are propagated: they reject the start() or stream() call and the run never executes, so this can be used as a pre-flight gate such as a quota check. The run record created by createRun() stays at status pending.
|
|
137
137
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.3.13-alpha.
|
|
3
|
+
"version": "1.3.13-alpha.2",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@mastra/mcp-legacy": "npm:@mastra/mcp@^1.18.0",
|
|
27
27
|
"local-pkg": "^1.2.1",
|
|
28
28
|
"zod": "^4.6.7",
|
|
29
|
-
"@mastra/core": "1.83.0-alpha.
|
|
30
|
-
"@mastra/mcp": "^2.9.0-alpha.
|
|
29
|
+
"@mastra/core": "1.83.0-alpha.1",
|
|
30
|
+
"@mastra/mcp": "^2.9.0-alpha.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@hono/node-server": "^2.1.3",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"vitest": "5.1.0",
|
|
45
45
|
"@internal/lint": "0.0.148",
|
|
46
46
|
"@internal/types-builder": "0.0.123",
|
|
47
|
-
"@mastra/core": "1.83.0-alpha.
|
|
47
|
+
"@mastra/core": "1.83.0-alpha.1"
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://mastra.ai",
|
|
50
50
|
"repository": {
|