@mastra/mcp-docs-server 0.13.31-alpha.0 → 0.13.32-alpha.0

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.
Files changed (68) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fchangeset-cli.md +2 -0
  2. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +8 -8
  3. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
  4. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +23 -19
  5. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +15 -15
  6. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +14 -14
  7. package/.docs/organized/changelogs/%40mastra%2Fcore.md +57 -57
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +17 -17
  9. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +21 -21
  10. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +21 -21
  11. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +21 -21
  12. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +27 -27
  13. package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
  14. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +14 -14
  15. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +15 -15
  16. package/.docs/organized/changelogs/%40mastra%2Fpg.md +21 -21
  17. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +25 -25
  18. package/.docs/organized/changelogs/%40mastra%2Freact.md +16 -0
  19. package/.docs/organized/changelogs/%40mastra%2Fserver.md +17 -17
  20. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +11 -11
  21. package/.docs/organized/changelogs/create-mastra.md +11 -11
  22. package/.docs/organized/changelogs/mastra.md +26 -26
  23. package/.docs/organized/code-examples/agui.md +2 -2
  24. package/.docs/organized/code-examples/ai-elements.md +2 -2
  25. package/.docs/organized/code-examples/ai-sdk-useChat.md +2 -2
  26. package/.docs/organized/code-examples/ai-sdk-v5.md +2 -2
  27. package/.docs/organized/code-examples/assistant-ui.md +2 -2
  28. package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +2 -2
  29. package/.docs/organized/code-examples/bird-checker-with-nextjs.md +2 -2
  30. package/.docs/organized/code-examples/client-side-tools.md +2 -2
  31. package/.docs/organized/code-examples/crypto-chatbot.md +2 -2
  32. package/.docs/organized/code-examples/heads-up-game.md +2 -2
  33. package/.docs/organized/code-examples/openapi-spec-writer.md +2 -2
  34. package/.docs/raw/agents/agent-memory.mdx +48 -31
  35. package/.docs/raw/agents/guardrails.mdx +8 -1
  36. package/.docs/raw/agents/networks.mdx +197 -128
  37. package/.docs/raw/agents/overview.mdx +14 -46
  38. package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +92 -1
  39. package/.docs/raw/getting-started/installation.mdx +61 -68
  40. package/.docs/raw/memory/conversation-history.mdx +2 -2
  41. package/.docs/raw/memory/semantic-recall.mdx +36 -10
  42. package/.docs/raw/rag/chunking-and-embedding.mdx +19 -7
  43. package/.docs/raw/reference/client-js/agents.mdx +44 -25
  44. package/.docs/raw/reference/scorers/answer-relevancy.mdx +3 -6
  45. package/.docs/raw/reference/scorers/answer-similarity.mdx +7 -13
  46. package/.docs/raw/reference/scorers/bias.mdx +3 -6
  47. package/.docs/raw/reference/scorers/completeness.mdx +3 -6
  48. package/.docs/raw/reference/scorers/context-precision.mdx +6 -9
  49. package/.docs/raw/reference/scorers/context-relevance.mdx +12 -18
  50. package/.docs/raw/reference/scorers/faithfulness.mdx +3 -6
  51. package/.docs/raw/reference/scorers/hallucination.mdx +3 -6
  52. package/.docs/raw/reference/scorers/noise-sensitivity.mdx +13 -23
  53. package/.docs/raw/reference/scorers/prompt-alignment.mdx +16 -20
  54. package/.docs/raw/reference/scorers/tool-call-accuracy.mdx +4 -5
  55. package/.docs/raw/reference/scorers/toxicity.mdx +3 -6
  56. package/.docs/raw/reference/workflows/step.mdx +1 -1
  57. package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +23 -2
  58. package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +22 -4
  59. package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +14 -4
  60. package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +18 -1
  61. package/.docs/raw/server-db/runtime-context.mdx +13 -3
  62. package/.docs/raw/streaming/tool-streaming.mdx +30 -0
  63. package/.docs/raw/tools-mcp/overview.mdx +3 -39
  64. package/.docs/raw/workflows/overview.mdx +137 -229
  65. package/.docs/raw/workflows/suspend-and-resume.mdx +34 -23
  66. package/CHANGELOG.md +14 -0
  67. package/package.json +5 -5
  68. package/.docs/raw/workflows/pausing-execution.mdx +0 -142
@@ -1,142 +0,0 @@
1
- ---
2
- title: "Pausing Execution | Mastra Docs"
3
- description: "Pausing execution in Mastra workflows allows you to pause execution while waiting for external input or resources via .sleep(), .sleepUntil() and .waitForEvent()."
4
- ---
5
-
6
- # Sleep & Events
7
-
8
- Mastra lets you pause workflow execution when waiting for external input or timing conditions. This can be useful for things like polling, delayed retries, or waiting on user actions.
9
-
10
- You can pause execution using:
11
-
12
- - `sleep()`: Pause for a set number of milliseconds
13
- - `sleepUntil()`: Pause until a specific timestamp
14
- - `waitForEvent()`: Pause until an external event is received
15
- - `sendEvent()`: Send an event to resume a waiting workflow
16
-
17
- When using any of these methods, the workflow status is set to `waiting` until execution resumes.
18
-
19
- ## Pausing with `.sleep()`
20
-
21
- The `sleep()` method pauses execution between steps for a specified number of milliseconds.
22
-
23
- ```typescript {9} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
24
- import { createWorkflow, createStep } from "@mastra/core/workflows";
25
- import { z } from "zod";
26
-
27
- const step1 = createStep({...});
28
- const step2 = createStep({...});
29
-
30
- export const testWorkflow = createWorkflow({...})
31
- .then(step1)
32
- .sleep(1000)
33
- .then(step2)
34
- .commit();
35
- ```
36
-
37
- ### Pausing with `.sleep(callback)`
38
-
39
- The `sleep()` method also accepts a callback that returns the number of milliseconds to pause. The callback receives `inputData`, allowing the delay to be computed dynamically.
40
-
41
- ```typescript {9} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
42
- import { createWorkflow, createStep } from "@mastra/core/workflows";
43
- import { z } from "zod";
44
-
45
- const step1 = createStep({...});
46
- const step2 = createStep({...});
47
-
48
- export const testWorkflow = createWorkflow({...})
49
- .then(step1)
50
- .sleep(async ({ inputData }) => {
51
- const { delayInMs } = inputData
52
- return delayInMs;
53
- })
54
- .then(step2)
55
- .commit();
56
- ```
57
-
58
- ## Pausing with `.sleepUntil()`
59
-
60
- The `sleepUntil()` method pauses execution between steps until a specified date.
61
-
62
- ```typescript {9} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
63
- import { createWorkflow, createStep } from "@mastra/core/workflows";
64
- import { z } from "zod";
65
-
66
- const step1 = createStep({...});
67
- const step2 = createStep({...});
68
-
69
- export const testWorkflow = createWorkflow({...})
70
- .then(step1)
71
- .sleepUntil(new Date(Date.now() + 5000))
72
- .then(step2)
73
- .commit();
74
- ```
75
-
76
- ### Pausing with `.sleepUntil(callback)`
77
-
78
- The `sleepUntil()` method also accepts a callback that returns a `Date` object. The callback receives `inputData`, allowing the target time to be computed dynamically.
79
-
80
- ```typescript {9} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
81
- import { createWorkflow, createStep } from "@mastra/core/workflows";
82
- import { z } from "zod";
83
-
84
- const step1 = createStep({...});
85
- const step2 = createStep({...});
86
-
87
- export const testWorkflow = createWorkflow({...})
88
- .then(step1)
89
- .sleepUntil(async ({ inputData }) => {
90
- const { delayInMs } = inputData
91
- return new Date(Date.now() + delayInMs);
92
- })
93
- .then(step2)
94
- .commit();
95
- ```
96
-
97
-
98
- > `Date.now()` is evaluated when the workflow starts, not at the moment the `sleepUntil()` method is called.
99
-
100
- ## Pausing with `.waitForEvent()`
101
-
102
- The `waitForEvent()` method pauses execution until a specific event is received. Use `run.sendEvent()` to send the event. You must provide both the event name and the step to resume.
103
-
104
- ![Pausing with .waitForEvent()](/image/workflows/workflows-sleep-events-waitforevent.jpg)
105
-
106
- ```typescript {10} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
107
- import { createWorkflow, createStep } from "@mastra/core/workflows";
108
- import { z } from "zod";
109
-
110
- const step1 = createStep({...});
111
- const step2 = createStep({...});
112
- const step3 = createStep({...});
113
-
114
- export const testWorkflow = createWorkflow({...})
115
- .then(step1)
116
- .waitForEvent("my-event-name", step2)
117
- .then(step3)
118
- .commit();
119
- ```
120
- ## Sending an event with `.sendEvent()`
121
-
122
- The `.sendEvent()` method sends an event to the workflow. It accepts the event name and optional event data, which can be any JSON-serializable value.
123
-
124
- ```typescript {5,12,15} filename="src/test-workflow.ts" showLineNumbers copy
125
- import { mastra } from "./mastra";
126
-
127
- const run = await mastra.getWorkflow("testWorkflow").createRunAsync();
128
-
129
- const result = run.start({
130
- inputData: {
131
- value: "hello"
132
- }
133
- });
134
-
135
- setTimeout(() => {
136
- run.sendEvent("my-event-name", { value: "from event" });
137
- }, 3000);
138
-
139
- console.log(JSON.stringify(await result, null, 2));
140
- ```
141
-
142
- > In this example, avoid using `await run.start()` directly, it would block sending the event before the workflow reaches its waiting state.