@mastra/mcp-docs-server 0.0.0-studio-deploy-20260404182525 → 0.0.0-studio-cli-20260504022012

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 (285) hide show
  1. package/.docs/docs/agents/adding-voice.md +18 -17
  2. package/.docs/docs/agents/background-tasks.md +242 -0
  3. package/.docs/docs/agents/channels.md +2 -1
  4. package/.docs/docs/agents/overview.md +4 -0
  5. package/.docs/docs/agents/processors.md +177 -5
  6. package/.docs/docs/agents/structured-output.md +66 -1
  7. package/.docs/docs/agents/supervisor-agents.md +65 -0
  8. package/.docs/docs/agents/using-tools.md +73 -0
  9. package/.docs/docs/browser/agent-browser.md +78 -0
  10. package/.docs/docs/browser/browser-viewer.md +144 -0
  11. package/.docs/docs/browser/overview.md +168 -0
  12. package/.docs/docs/browser/stagehand.md +129 -0
  13. package/.docs/docs/deployment/cloud-providers.md +5 -1
  14. package/.docs/docs/deployment/mastra-server.md +4 -4
  15. package/.docs/docs/deployment/monorepo.md +3 -3
  16. package/.docs/docs/deployment/overview.md +11 -8
  17. package/.docs/docs/editor/overview.md +290 -0
  18. package/.docs/docs/editor/prompts.md +134 -0
  19. package/.docs/docs/editor/tools.md +152 -0
  20. package/.docs/docs/evals/custom-scorers.md +63 -3
  21. package/.docs/docs/evals/datasets/overview.md +1 -1
  22. package/.docs/docs/index.md +2 -2
  23. package/.docs/docs/mastra-platform/configuration.md +36 -0
  24. package/.docs/docs/mastra-platform/overview.md +78 -0
  25. package/.docs/docs/mcp/overview.md +17 -0
  26. package/.docs/docs/memory/memory-processors.md +3 -3
  27. package/.docs/docs/memory/message-history.md +8 -2
  28. package/.docs/docs/memory/observational-memory.md +65 -8
  29. package/.docs/docs/memory/storage.md +1 -2
  30. package/.docs/docs/memory/working-memory.md +2 -2
  31. package/.docs/docs/observability/logging.md +1 -1
  32. package/.docs/docs/observability/metrics/overview.md +2 -2
  33. package/.docs/docs/observability/overview.md +1 -1
  34. package/.docs/docs/observability/tracing/bridges/datadog.md +217 -0
  35. package/.docs/docs/observability/tracing/bridges/otel.md +2 -2
  36. package/.docs/docs/observability/tracing/exporters/arthur.md +163 -0
  37. package/.docs/docs/observability/tracing/exporters/cloud.md +135 -63
  38. package/.docs/docs/observability/tracing/exporters/datadog.md +3 -1
  39. package/.docs/docs/observability/tracing/exporters/default.md +5 -5
  40. package/.docs/docs/observability/tracing/exporters/laminar.md +22 -14
  41. package/.docs/docs/observability/tracing/exporters/langfuse.md +50 -33
  42. package/.docs/docs/observability/tracing/overview.md +87 -20
  43. package/.docs/docs/server/custom-adapters.md +5 -5
  44. package/.docs/docs/server/custom-api-routes.md +3 -3
  45. package/.docs/docs/server/mastra-client.md +2 -2
  46. package/.docs/docs/server/mastra-server.md +1 -1
  47. package/.docs/docs/server/middleware.md +46 -42
  48. package/.docs/docs/server/request-context.md +13 -2
  49. package/.docs/docs/server/server-adapters.md +91 -8
  50. package/.docs/docs/streaming/background-task-streaming.md +80 -0
  51. package/.docs/docs/streaming/overview.md +3 -0
  52. package/.docs/docs/studio/deployment.md +24 -6
  53. package/.docs/docs/studio/observability.md +1 -1
  54. package/.docs/docs/studio/overview.md +4 -4
  55. package/.docs/docs/voice/overview.md +74 -5
  56. package/.docs/docs/voice/speech-to-speech.md +45 -1
  57. package/.docs/docs/voice/speech-to-text.md +7 -7
  58. package/.docs/docs/voice/text-to-speech.md +10 -10
  59. package/.docs/docs/workflows/agents-and-tools.md +1 -1
  60. package/.docs/docs/workflows/overview.md +105 -4
  61. package/.docs/docs/workflows/scheduled-workflows.md +181 -0
  62. package/.docs/docs/workspace/filesystem.md +64 -6
  63. package/.docs/docs/workspace/lsp.md +76 -4
  64. package/.docs/docs/workspace/overview.md +62 -15
  65. package/.docs/docs/workspace/sandbox.md +3 -1
  66. package/.docs/docs/workspace/search.md +41 -2
  67. package/.docs/docs/workspace/skills.md +19 -19
  68. package/.docs/guides/agent-frameworks/ai-sdk.md +4 -4
  69. package/.docs/guides/build-your-ui/ai-sdk-ui.md +56 -9
  70. package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
  71. package/.docs/guides/deployment/mastra-platform.md +191 -0
  72. package/.docs/guides/deployment/netlify.md +16 -1
  73. package/.docs/guides/getting-started/nestjs.md +238 -0
  74. package/.docs/guides/getting-started/next-js.md +0 -4
  75. package/.docs/guides/guide/code-review-bot.md +2 -2
  76. package/.docs/guides/guide/dev-assistant.md +4 -4
  77. package/.docs/{docs/mcp → guides/guide}/publishing-mcp-server.md +21 -1
  78. package/.docs/guides/guide/slack-assistant.md +191 -0
  79. package/.docs/guides/migrations/mastra-cloud.md +368 -0
  80. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
  81. package/.docs/models/embeddings.md +3 -3
  82. package/.docs/models/gateways/azure-openai.md +74 -35
  83. package/.docs/models/gateways/mastra.md +64 -0
  84. package/.docs/models/gateways/netlify.md +7 -3
  85. package/.docs/models/gateways/openrouter.md +28 -12
  86. package/.docs/models/gateways/vercel.md +22 -2
  87. package/.docs/models/gateways.md +1 -0
  88. package/.docs/models/index.md +43 -8
  89. package/.docs/models/providers/302ai.md +37 -4
  90. package/.docs/models/providers/abliteration-ai.md +71 -0
  91. package/.docs/models/providers/alibaba-cn.md +8 -2
  92. package/.docs/models/providers/alibaba-coding-plan-cn.md +3 -2
  93. package/.docs/models/providers/alibaba-coding-plan.md +3 -2
  94. package/.docs/models/providers/alibaba.md +8 -1
  95. package/.docs/models/providers/anthropic.md +18 -5
  96. package/.docs/models/providers/baseten.md +3 -1
  97. package/.docs/models/providers/berget.md +10 -12
  98. package/.docs/models/providers/chutes.md +4 -2
  99. package/.docs/models/providers/cloudflare-workers-ai.md +14 -48
  100. package/.docs/models/providers/cortecs.md +22 -2
  101. package/.docs/models/providers/deepinfra.md +8 -2
  102. package/.docs/models/providers/deepseek.md +6 -4
  103. package/.docs/models/providers/digitalocean.md +133 -0
  104. package/.docs/models/providers/fireworks-ai.md +6 -1
  105. package/.docs/models/providers/firmware.md +12 -10
  106. package/.docs/models/providers/friendli.md +6 -7
  107. package/.docs/models/providers/google.md +9 -3
  108. package/.docs/models/providers/helicone.md +1 -2
  109. package/.docs/models/providers/hpc-ai.md +73 -0
  110. package/.docs/models/providers/huggingface.md +6 -2
  111. package/.docs/models/providers/inception.md +9 -11
  112. package/.docs/models/providers/kilo.md +359 -339
  113. package/.docs/models/providers/kimi-for-coding.md +2 -1
  114. package/.docs/models/providers/llmgateway.md +67 -77
  115. package/.docs/models/providers/mistral.md +3 -2
  116. package/.docs/models/providers/mixlayer.md +75 -0
  117. package/.docs/models/providers/moonshotai-cn.md +3 -2
  118. package/.docs/models/providers/moonshotai.md +3 -2
  119. package/.docs/models/providers/nano-gpt.md +8 -2
  120. package/.docs/models/providers/neuralwatt.md +84 -0
  121. package/.docs/models/providers/novita-ai.md +19 -4
  122. package/.docs/models/providers/nvidia.md +8 -1
  123. package/.docs/models/providers/ollama-cloud.md +7 -2
  124. package/.docs/models/providers/openai.md +7 -2
  125. package/.docs/models/providers/opencode-go.md +21 -13
  126. package/.docs/models/providers/opencode.md +11 -4
  127. package/.docs/models/providers/ovhcloud.md +6 -8
  128. package/.docs/models/providers/poe.md +10 -15
  129. package/.docs/models/providers/regolo-ai.md +83 -0
  130. package/.docs/models/providers/siliconflow-cn.md +5 -2
  131. package/.docs/models/providers/siliconflow.md +6 -3
  132. package/.docs/models/providers/stepfun.md +8 -7
  133. package/.docs/models/providers/synthetic.md +5 -2
  134. package/.docs/models/providers/tencent-token-plan.md +71 -0
  135. package/.docs/models/providers/tencent-tokenhub.md +71 -0
  136. package/.docs/models/providers/togetherai.md +8 -7
  137. package/.docs/models/providers/vivgrid.md +7 -3
  138. package/.docs/models/providers/vultr.md +7 -6
  139. package/.docs/models/providers/wafer.ai.md +73 -0
  140. package/.docs/models/providers/wandb.md +3 -2
  141. package/.docs/models/providers/xai.md +6 -1
  142. package/.docs/models/providers/xiaomi-token-plan-ams.md +75 -0
  143. package/.docs/models/providers/xiaomi-token-plan-cn.md +75 -0
  144. package/.docs/models/providers/xiaomi-token-plan-sgp.md +75 -0
  145. package/.docs/models/providers/xiaomi.md +4 -2
  146. package/.docs/models/providers/zai-coding-plan.md +11 -19
  147. package/.docs/models/providers/zai.md +2 -1
  148. package/.docs/models/providers/zenmux.md +17 -6
  149. package/.docs/models/providers/zhipuai-coding-plan.md +11 -21
  150. package/.docs/models/providers/zhipuai.md +2 -1
  151. package/.docs/models/providers.md +11 -0
  152. package/.docs/reference/agents/agent.md +1 -1
  153. package/.docs/reference/agents/channels.md +3 -3
  154. package/.docs/reference/agents/generate.md +88 -6
  155. package/.docs/reference/agents/generateLegacy.md +1 -1
  156. package/.docs/reference/ai-sdk/chat-route.md +2 -0
  157. package/.docs/reference/ai-sdk/handle-chat-stream.md +19 -0
  158. package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
  159. package/.docs/reference/ai-sdk/network-route.md +2 -0
  160. package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +95 -0
  161. package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +15 -0
  162. package/.docs/reference/browser/agent-browser.md +375 -0
  163. package/.docs/reference/browser/browser-viewer.md +228 -0
  164. package/.docs/reference/browser/mastra-browser.md +286 -0
  165. package/.docs/reference/browser/stagehand-browser.md +286 -0
  166. package/.docs/reference/cli/mastra.md +703 -0
  167. package/.docs/reference/client-js/agents.md +166 -0
  168. package/.docs/reference/client-js/conversations.md +1 -1
  169. package/.docs/reference/client-js/mastra-client.md +23 -0
  170. package/.docs/reference/client-js/observability.md +2 -2
  171. package/.docs/reference/client-js/responses.md +1 -1
  172. package/.docs/reference/client-js/workflows.md +62 -1
  173. package/.docs/reference/configuration.md +67 -1
  174. package/.docs/reference/core/addGateway.md +5 -5
  175. package/.docs/reference/core/getEditor.md +35 -0
  176. package/.docs/reference/core/getGateway.md +5 -5
  177. package/.docs/reference/core/getGatewayById.md +5 -5
  178. package/.docs/reference/core/getMCPServer.md +2 -2
  179. package/.docs/reference/core/getMCPServerById.md +2 -2
  180. package/.docs/reference/core/getScorer.md +3 -3
  181. package/.docs/reference/core/getScorerById.md +3 -3
  182. package/.docs/reference/core/listGateways.md +5 -5
  183. package/.docs/reference/core/listMCPServers.md +2 -2
  184. package/.docs/reference/core/listScorers.md +3 -3
  185. package/.docs/reference/core/mastra-class.md +11 -1
  186. package/.docs/reference/core/mastra-model-gateway.md +5 -5
  187. package/.docs/reference/datasets/create.md +4 -4
  188. package/.docs/reference/datasets/startExperiment.md +28 -2
  189. package/.docs/reference/datasets/update.md +4 -4
  190. package/.docs/reference/deployer/cloudflare.md +14 -1
  191. package/.docs/reference/deployer/netlify.md +50 -2
  192. package/.docs/reference/editor/mastra-editor.md +168 -0
  193. package/.docs/reference/editor/tool-provider.md +85 -0
  194. package/.docs/reference/evals/context-precision.md +3 -3
  195. package/.docs/reference/evals/context-relevance.md +3 -3
  196. package/.docs/reference/evals/create-scorer.md +5 -3
  197. package/.docs/reference/evals/filter-run.md +117 -0
  198. package/.docs/reference/evals/mastra-scorer.md +4 -4
  199. package/.docs/reference/evals/noise-sensitivity.md +6 -6
  200. package/.docs/reference/evals/prompt-alignment.md +12 -12
  201. package/.docs/reference/evals/run-evals.md +6 -6
  202. package/.docs/reference/evals/scorer-utils.md +3 -3
  203. package/.docs/reference/evals/trajectory-accuracy.md +3 -3
  204. package/.docs/reference/harness/harness-class.md +152 -53
  205. package/.docs/reference/index.md +25 -0
  206. package/.docs/reference/logging/pino-logger.md +0 -2
  207. package/.docs/reference/mastra-platform/api.md +108 -0
  208. package/.docs/reference/memory/clone-utilities.md +4 -2
  209. package/.docs/reference/memory/cloneThread.md +4 -2
  210. package/.docs/reference/memory/observational-memory.md +4 -0
  211. package/.docs/reference/observability/metrics/automatic-metrics.md +3 -3
  212. package/.docs/reference/observability/tracing/bridges/datadog.md +211 -0
  213. package/.docs/reference/observability/tracing/bridges/otel.md +3 -3
  214. package/.docs/reference/observability/tracing/configuration.md +18 -11
  215. package/.docs/reference/observability/tracing/exporters/arthur.md +122 -0
  216. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +102 -21
  217. package/.docs/reference/observability/tracing/exporters/console-exporter.md +8 -8
  218. package/.docs/reference/observability/tracing/exporters/datadog.md +3 -1
  219. package/.docs/reference/observability/tracing/exporters/default-exporter.md +8 -8
  220. package/.docs/reference/observability/tracing/exporters/langfuse.md +25 -32
  221. package/.docs/reference/observability/tracing/exporters/otel.md +3 -3
  222. package/.docs/reference/observability/tracing/instances.md +7 -7
  223. package/.docs/reference/observability/tracing/interfaces.md +23 -6
  224. package/.docs/reference/observability/tracing/span-filtering.md +95 -0
  225. package/.docs/reference/observability/tracing/spans.md +6 -6
  226. package/.docs/reference/processors/prefill-error-handler.md +70 -0
  227. package/.docs/reference/processors/processor-interface.md +400 -40
  228. package/.docs/reference/processors/skill-search-processor.md +20 -1
  229. package/.docs/reference/processors/stream-error-retry-processor.md +54 -0
  230. package/.docs/reference/processors/tool-call-filter.md +23 -0
  231. package/.docs/reference/server/create-route.md +3 -3
  232. package/.docs/reference/server/express-adapter.md +4 -4
  233. package/.docs/reference/server/fastify-adapter.md +4 -4
  234. package/.docs/reference/server/hono-adapter.md +4 -4
  235. package/.docs/reference/server/koa-adapter.md +4 -4
  236. package/.docs/reference/server/mastra-server.md +3 -3
  237. package/.docs/reference/server/nestjs-adapter.md +169 -0
  238. package/.docs/reference/server/register-api-route.md +4 -4
  239. package/.docs/reference/server/routes.md +11 -10
  240. package/.docs/reference/storage/clickhouse.md +300 -0
  241. package/.docs/reference/storage/cloudflare-d1.md +42 -42
  242. package/.docs/reference/storage/composite.md +5 -3
  243. package/.docs/reference/storage/duckdb.md +150 -0
  244. package/.docs/reference/storage/overview.md +1 -1
  245. package/.docs/reference/storage/redis.md +266 -0
  246. package/.docs/reference/streaming/ChunkType.md +143 -3
  247. package/.docs/reference/streaming/agents/MastraModelOutput.md +2 -2
  248. package/.docs/reference/streaming/agents/stream.md +10 -2
  249. package/.docs/reference/streaming/agents/streamUntilIdle.md +94 -0
  250. package/.docs/reference/streaming/workflows/resumeStream.md +2 -0
  251. package/.docs/reference/templates/overview.md +88 -14
  252. package/.docs/reference/tools/create-tool.md +107 -5
  253. package/.docs/reference/tools/mcp-client.md +45 -0
  254. package/.docs/reference/tools/mcp-server.md +1 -3
  255. package/.docs/reference/tools/perplexity.md +155 -0
  256. package/.docs/reference/tools/tavily.md +307 -0
  257. package/.docs/reference/vectors/mongodb.md +0 -2
  258. package/.docs/reference/voice/aws-nova-sonic.md +247 -0
  259. package/.docs/reference/voice/cloudflare.md +3 -3
  260. package/.docs/reference/voice/sarvam.md +29 -23
  261. package/.docs/reference/voice/voice.connect.md +4 -4
  262. package/.docs/reference/voice/voice.listen.md +3 -3
  263. package/.docs/reference/workflows/run-methods/resume.md +24 -0
  264. package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
  265. package/.docs/reference/workflows/step.md +88 -7
  266. package/.docs/reference/workflows/workflow-methods/foreach.md +14 -1
  267. package/.docs/reference/workflows/workflow.md +88 -4
  268. package/.docs/reference/workspace/azure-blob-filesystem.md +219 -0
  269. package/.docs/reference/workspace/docker-sandbox.md +196 -0
  270. package/.docs/reference/workspace/gcs-filesystem.md +1 -0
  271. package/.docs/reference/workspace/google-drive-filesystem.md +185 -0
  272. package/.docs/reference/workspace/modal-sandbox.md +168 -0
  273. package/.docs/reference/workspace/process-manager.md +1 -1
  274. package/.docs/reference/workspace/s3-filesystem.md +80 -5
  275. package/.docs/reference/workspace/vercel.md +1 -1
  276. package/.docs/reference/workspace/workspace-class.md +37 -6
  277. package/CHANGELOG.md +500 -4
  278. package/dist/stdio.js.map +1 -1
  279. package/dist/utils.d.ts +1 -4
  280. package/dist/utils.d.ts.map +1 -1
  281. package/package.json +11 -11
  282. package/.docs/docs/mastra-cloud/deployment.md +0 -77
  283. package/.docs/docs/mastra-cloud/observability.md +0 -38
  284. package/.docs/docs/mastra-cloud/overview.md +0 -23
  285. package/.docs/docs/mastra-cloud/setup.md +0 -42
@@ -4,10 +4,10 @@ This reference provides comprehensive information about Mastra templates, includ
4
4
 
5
5
  Mastra templates are pre-built project structures that demonstrate specific use cases and patterns. They provide:
6
6
 
7
- - **Working examples** - Complete, functional Mastra applications
8
- - **Best practices** - Proper project structure and coding conventions
9
- - **Educational resources** - Learn Mastra patterns through real implementations
10
- - **Quickstarts** - Bootstrap projects faster than building from scratch
7
+ - **Working examples**: Complete, functional Mastra applications
8
+ - **Best practices**: Proper project structure and coding conventions
9
+ - **Educational resources**: Learn Mastra patterns through real implementations
10
+ - **Quickstarts**: Bootstrap projects faster than building from scratch
11
11
 
12
12
  ## Using templates
13
13
 
@@ -15,10 +15,30 @@ Mastra templates are pre-built project structures that demonstrate specific use
15
15
 
16
16
  Install a template using the `create-mastra` command:
17
17
 
18
- ```bash
18
+ **npm**:
19
+
20
+ ```sh
19
21
  npx create-mastra@latest --template template-name
20
22
  ```
21
23
 
24
+ **pnpm**:
25
+
26
+ ```sh
27
+ pnpm dlx create-mastra@latest --template template-name
28
+ ```
29
+
30
+ **Yarn**:
31
+
32
+ ```sh
33
+ yarn dlx create-mastra@latest --template template-name
34
+ ```
35
+
36
+ **Bun**:
37
+
38
+ ```sh
39
+ bun x create-mastra@latest --template template-name
40
+ ```
41
+
22
42
  This creates a complete project with all necessary code and configuration.
23
43
 
24
44
  ### Setup Process
@@ -41,20 +61,74 @@ After installation:
41
61
 
42
62
  3. **Install dependencies** (if not done automatically):
43
63
 
44
- ```bash
64
+ **npm**:
65
+
66
+ ```sh
45
67
  npm install
46
68
  ```
47
69
 
70
+ **pnpm**:
71
+
72
+ ```sh
73
+ pnpm install
74
+ ```
75
+
76
+ **Yarn**:
77
+
78
+ ```sh
79
+ yarn install
80
+ ```
81
+
82
+ **Bun**:
83
+
84
+ ```sh
85
+ bun install
86
+ ```
87
+
48
88
  4. **Start development server**:
49
89
 
50
- ```bash
90
+ **npm**:
91
+
92
+ ```sh
51
93
  npm run dev
52
94
  ```
53
95
 
54
- ### Template Structure
96
+ **pnpm**:
97
+
98
+ ```sh
99
+ pnpm run dev
100
+ ```
101
+
102
+ **Yarn**:
103
+
104
+ ```sh
105
+ yarn dev
106
+ ```
107
+
108
+ **Bun**:
109
+
110
+ ```sh
111
+ bun run dev
112
+ ```
113
+
114
+ ### Template structure
55
115
 
56
116
  All templates follow this standardized structure:
57
117
 
118
+ ```text
119
+ your-template/
120
+ ├── src/
121
+ │ └── mastra/
122
+ │ ├── agents/ # Agent definitions
123
+ │ ├── tools/ # Tool definitions
124
+ │ ├── workflows/ # Workflow definitions
125
+ │ └── index.ts # Main Mastra config
126
+ ├── .env.example # Required environment variables
127
+ ├── package.json
128
+ ├── tsconfig.json
129
+ └── README.md
130
+ ```
131
+
58
132
  ## Creating templates
59
133
 
60
134
  ### Requirements
@@ -127,12 +201,12 @@ const agent = new Agent({
127
201
 
128
202
  Templates must be:
129
203
 
130
- - **Single projects** - Not monorepos with multiple applications
131
- - **Framework-free** - No Next.js, Express, or other web framework boilerplate
132
- - **Mastra-focused** - Demonstrate Mastra functionality without additional layers
133
- - **Mergeable** - Structure code for seamless integration into existing projects
134
- - **Node.js compatible** - Support Node.js v22.13.0 and later
135
- - **ESM modules** - Use ES modules (`"type": "module"` in package.json)
204
+ - **Single projects**: Not monorepos with multiple applications
205
+ - **Framework-free**: No Next.js, Express, or other web framework boilerplate
206
+ - **Mastra-focused**: Demonstrate Mastra functionality without additional layers
207
+ - **Mergeable**: Structure code for seamless integration into existing projects
208
+ - **Node.js compatible**: Support Node.js v22.13.0 and later
209
+ - **ESM modules**: Use ES modules (`"type": "module"` in package.json)
136
210
 
137
211
  ### Documentation Requirements
138
212
 
@@ -27,6 +27,106 @@ export const tool = createTool({
27
27
  })
28
28
  ```
29
29
 
30
+ ## Define schemas
31
+
32
+ You can define the tool's `inputSchema` and `outputSchema` with any library that supports [Standard JSON Schema](https://standardschema.dev/json-schema). This includes libraries like [Zod](https://zod.dev/), [Valibot](https://valibot.dev/), and [ArkType](https://arktype.io/).
33
+
34
+ **Zod**:
35
+
36
+ ```typescript
37
+ import { createTool } from '@mastra/core/tools'
38
+ import { z } from 'zod'
39
+
40
+ export const weatherTool = createTool({
41
+ id: 'weather-tool',
42
+ description: 'Fetches weather for a location',
43
+ inputSchema: z.object({
44
+ location: z.string(),
45
+ }),
46
+ outputSchema: z.object({
47
+ weather: z.string(),
48
+ }),
49
+ execute: async inputData => {
50
+ // Fetch weather data
51
+ },
52
+ })
53
+ ```
54
+
55
+ **Valibot**:
56
+
57
+ ```typescript
58
+ import { createTool } from '@mastra/core/tools'
59
+ import * as v from 'valibot'
60
+ import { toStandardJsonSchema } from '@valibot/to-json-schema'
61
+
62
+ export const weatherTool = createTool({
63
+ id: 'weather-tool',
64
+ description: 'Fetches weather for a location',
65
+ inputSchema: toStandardJsonSchema(
66
+ v.object({
67
+ location: v.string(),
68
+ }),
69
+ ),
70
+ outputSchema: toStandardJsonSchema(
71
+ v.object({
72
+ weather: v.string(),
73
+ }),
74
+ ),
75
+ execute: async inputData => {
76
+ // Fetch weather data
77
+ },
78
+ })
79
+ ```
80
+
81
+ **ArkType**:
82
+
83
+ ```typescript
84
+ import { createTool } from '@mastra/core/tools'
85
+ import { type } from 'arktype'
86
+
87
+ export const weatherTool = createTool({
88
+ id: 'weather-tool',
89
+ description: 'Fetches weather for a location',
90
+ inputSchema: type({
91
+ location: 'string',
92
+ }),
93
+ outputSchema: type({
94
+ weather: 'string',
95
+ }),
96
+ execute: async inputData => {
97
+ // Fetch weather data
98
+ },
99
+ })
100
+ ```
101
+
102
+ ## Example with strict tool inputs
103
+
104
+ Set `strict: true` when you want Mastra to ask supported model providers to generate tool arguments that exactly match the tool schema.
105
+
106
+ ```typescript
107
+ import { createTool } from '@mastra/core/tools'
108
+ import { z } from 'zod'
109
+
110
+ export const weatherTool = createTool({
111
+ id: 'get-weather',
112
+ description: 'Get weather for a city',
113
+ strict: true,
114
+ inputSchema: z.object({
115
+ city: z.string(),
116
+ units: z.enum(['metric', 'imperial']),
117
+ }),
118
+ execute: async ({ city, units }) => {
119
+ return {
120
+ city,
121
+ units,
122
+ forecast: 'sunny',
123
+ }
124
+ },
125
+ })
126
+ ```
127
+
128
+ Mastra forwards `strict: true` to model adapters that support strict tool calling. On adapters that do not support strict tool calling, Mastra ignores this option.
129
+
30
130
  ## Example with `toModelOutput`
31
131
 
32
132
  Use `toModelOutput` when your tool should return rich internal data to your app, but the model should receive either a simplified value or multimodal content.
@@ -116,21 +216,23 @@ export const weatherTool = createTool({
116
216
 
117
217
  **description** (`string`): A description of what the tool does. This is used by the agent to decide when to use the tool.
118
218
 
119
- **inputSchema** (`Zod schema`): A Zod schema defining the expected input parameters for the tool's \`execute\` function.
219
+ **inputSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the expected input parameters for the tool's \`execute\` function.
220
+
221
+ **outputSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the expected output structure of the tool's \`execute\` function.
120
222
 
121
- **outputSchema** (`Zod schema`): A Zod schema defining the expected output structure of the tool's \`execute\` function.
223
+ **strict** (`boolean`): When true, Mastra enables strict tool input generation on model adapters that support it. This helps supported providers return arguments that match the tool schema more closely.
122
224
 
123
225
  **toModelOutput** (`(output: TSchemaOut) => unknown`): Optional function that transforms the tool's \`execute\` output before it is sent back to the model. Use this to return \`text\`, \`json\`, or \`content\`-shaped outputs (including multimodal parts like images/files) to the model while still keeping the full raw output in your application code.
124
226
 
125
- **suspendSchema** (`Zod schema`): A Zod schema defining the structure of the payload passed to \`suspend()\`. This payload is returned to the client when the tool suspends execution.
227
+ **suspendSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the structure of the payload passed to \`suspend()\`. This payload is returned to the client when the tool suspends execution.
126
228
 
127
- **resumeSchema** (`Zod schema`): A Zod schema defining the expected structure of \`resumeData\` when the tool is resumed. Used by the agent to extract data from user messages when \`autoResumeSuspendedTools\` is enabled.
229
+ **resumeSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema defining the expected structure of \`resumeData\` when the tool is resumed. Used by the agent to extract data from user messages when \`autoResumeSuspendedTools\` is enabled.
128
230
 
129
231
  **requireApproval** (`boolean`): When true, the tool requires explicit approval before execution. The agent will emit a \`tool-call-approval\` chunk and pause until approved or declined.
130
232
 
131
233
  **mcp** (`MCPToolProperties`): MCP-specific properties for tools exposed via Model Context Protocol. Includes \`annotations\` (tool behavior hints like \`title\`, \`readOnlyHint\`, \`destructiveHint\`, \`idempotentHint\`, \`openWorldHint\`) and \`\_meta\` (arbitrary metadata passed through to MCP clients).
132
234
 
133
- **requestContextSchema** (`Zod schema`): A Zod schema for validating request context values. When provided, the context is validated before execute() runs, returning an error object if validation fails.
235
+ **requestContextSchema** (`StandardJSONSchemaV1`): A Standard JSON Schema for validating request context values. When provided, the context is validated before execute() runs, returning an error object if validation fails.
134
236
 
135
237
  **execute** (`function`): The function that contains the tool's logic. It receives two parameters: the validated input data (first parameter) and an optional execution context object (second parameter) containing \`requestContext\`, \`tracingContext\`, \`abortSignal\`, and other execution metadata.
136
238
 
@@ -53,6 +53,51 @@ Each server in the `servers` map is configured using the `MastraMCPServerDefinit
53
53
 
54
54
  **enableServerLogs** (`boolean`): Whether to enable logging for this server. (Default: `true`)
55
55
 
56
+ **requireToolApproval** (`boolean | (params: RequireToolApprovalContext) => boolean | Promise<boolean>`): Require human approval before executing tools from this server. When set to \`true\`, all tools require approval. When set to a function, the function is called with the tool name, arguments, and request context to dynamically decide whether approval is needed.
57
+
58
+ ## Tool approval
59
+
60
+ Use `requireToolApproval` on a server definition to require human approval before any tool from that server is executed. This works with the existing [human-in-the-loop](https://mastra.ai/docs/workflows/human-in-the-loop) approval flow.
61
+
62
+ ### Require approval for all tools
63
+
64
+ Set `requireToolApproval` to `true` to require approval for every tool on the server:
65
+
66
+ ```typescript
67
+ const mcp = new MCPClient({
68
+ servers: {
69
+ github: {
70
+ url: new URL('http://localhost:3000/mcp'),
71
+ requireToolApproval: true,
72
+ },
73
+ },
74
+ })
75
+ ```
76
+
77
+ ### Dynamic approval with a function
78
+
79
+ Pass a function to decide per-call whether approval is needed. The function receives the tool name, the arguments the model passed, and any request context from the incoming request:
80
+
81
+ ```typescript
82
+ const mcp = new MCPClient({
83
+ servers: {
84
+ github: {
85
+ url: new URL('http://localhost:3000/mcp'),
86
+ requireToolApproval: ({ toolName, args, requestContext }) => {
87
+ // Read-only tools don't need approval
88
+ if (toolName === 'list_repos') return false
89
+ // Destructive tools with force flag always need approval
90
+ if (toolName === 'delete_repo') return args.force === true
91
+ // Non-admin users need approval for everything else
92
+ return requestContext?.userRole !== 'admin'
93
+ },
94
+ },
95
+ },
96
+ })
97
+ ```
98
+
99
+ The function can also be async. It receives `requestContext` from the incoming request, which you can use for auth checks or other per-request logic.
100
+
56
101
  ## Methods
57
102
 
58
103
  ### `listTools()`
@@ -768,11 +768,9 @@ await serverWithPrompts.prompts.notifyListChanged()
768
768
  - Handle errors with informative messages.
769
769
  - Document argument expectations and available versions.
770
770
 
771
- ***
772
-
773
771
  ## Examples
774
772
 
775
- For practical examples of setting up and deploying an MCPServer, see the [Publishing an MCP Server guide](https://mastra.ai/docs/mcp/publishing-mcp-server).
773
+ For practical examples of setting up and deploying an MCPServer, see the [Publishing an MCP Server guide](https://mastra.ai/guides/guide/publishing-mcp-server).
776
774
 
777
775
  The example at the beginning of this page also demonstrates how to instantiate `MCPServer` with both tools and agents.
778
776
 
@@ -0,0 +1,155 @@
1
+ # Perplexity tools
2
+
3
+ Added in: `@mastra/perplexity@0.1.0-alpha.0`
4
+
5
+ The `@mastra/perplexity` package wraps the [Perplexity Search API](https://docs.perplexity.ai/docs/search/quickstart) as a Mastra-compatible tool. It exposes a factory function that returns a tool created with [`createTool()`](https://mastra.ai/reference/tools/create-tool) and full Zod input/output schemas.
6
+
7
+ For chat completions or agentic workflows powered by Perplexity, use Mastra's built-in [Perplexity model provider](https://mastra.ai/models/providers/perplexity) or [Perplexity Agent provider](https://mastra.ai/models/providers/perplexity-agent). Those are separate from this Search tool.
8
+
9
+ ## Installation
10
+
11
+ Install the package alongside Zod:
12
+
13
+ **npm**:
14
+
15
+ ```sh
16
+ npm install @mastra/perplexity zod
17
+ ```
18
+
19
+ **pnpm**:
20
+
21
+ ```sh
22
+ pnpm add @mastra/perplexity zod
23
+ ```
24
+
25
+ **Yarn**:
26
+
27
+ ```sh
28
+ yarn add @mastra/perplexity zod
29
+ ```
30
+
31
+ **Bun**:
32
+
33
+ ```sh
34
+ bun add @mastra/perplexity zod
35
+ ```
36
+
37
+ ## Usage example
38
+
39
+ The following example creates the search tool with the default configuration. By default, the tool reads `PERPLEXITY_API_KEY` (with `PPLX_API_KEY` as a fallback) from the environment. Pass `{ apiKey }` explicitly to override.
40
+
41
+ ```typescript
42
+ import { createPerplexitySearchTool } from '@mastra/perplexity'
43
+
44
+ const searchTool = createPerplexitySearchTool()
45
+ ```
46
+
47
+ To pass an API key explicitly:
48
+
49
+ ```typescript
50
+ import { createPerplexitySearchTool } from '@mastra/perplexity'
51
+
52
+ const searchTool = createPerplexitySearchTool({ apiKey: 'pplx-...' })
53
+ ```
54
+
55
+ ## Configuration
56
+
57
+ All factory functions accept a `PerplexityClientOptions` object:
58
+
59
+ **apiKey** (`string`): Perplexity API key. Falls back to the \`PERPLEXITY\_API\_KEY\` then \`PPLX\_API\_KEY\` environment variables.
60
+
61
+ **baseUrl** (`string`): Override the API base URL. (Default: `'https://api.perplexity.ai'`)
62
+
63
+ **fetch** (`typeof fetch`): Custom \`fetch\` implementation. Useful for tests, retries, or instrumentation.
64
+
65
+ ## Methods
66
+
67
+ ### Factory functions
68
+
69
+ #### `createPerplexityTools(config?)`
70
+
71
+ Returns an object containing all Perplexity tools that share the supplied configuration.
72
+
73
+ ```typescript
74
+ import { createPerplexityTools } from '@mastra/perplexity'
75
+
76
+ const tools = createPerplexityTools({ apiKey: 'pplx-...' })
77
+ // tools.perplexitySearch
78
+ ```
79
+
80
+ Returns: `{ perplexitySearch }`
81
+
82
+ #### `createPerplexitySearchTool(config?)`
83
+
84
+ Creates a tool that searches the web using the Perplexity Search API. Returns ranked results with titles, URLs, snippets, and optional publication dates.
85
+
86
+ The tool is registered with the ID `perplexity-search`.
87
+
88
+ ```typescript
89
+ import { createPerplexitySearchTool } from '@mastra/perplexity'
90
+
91
+ const searchTool = createPerplexitySearchTool()
92
+ ```
93
+
94
+ ##### Input
95
+
96
+ **query** (`string`): The search query.
97
+
98
+ **maxResults** (`number`): Maximum number of results to return (1-20).
99
+
100
+ **searchDomainFilter** (`string[]`): Restrict (or exclude) results by domain. Prefix a domain with \`-\` to exclude it (for example, \`-pinterest.com\`). Do not mix allow- and deny-list entries in the same call.
101
+
102
+ **searchRecencyFilter** (`'hour' | 'day' | 'week' | 'month' | 'year'`): Only return results from within the given recency window.
103
+
104
+ **searchAfterDateFilter** (`string`): Only return results published on or after this date. Format: m/d/yyyy.
105
+
106
+ **searchBeforeDateFilter** (`string`): Only return results published on or before this date. Format: m/d/yyyy.
107
+
108
+ ##### Output
109
+
110
+ **query** (`string`): The original search query.
111
+
112
+ **results** (`SearchResult[]`): Array of search results.
113
+
114
+ **results.title** (`string`): Result title.
115
+
116
+ **results.url** (`string`): Result URL.
117
+
118
+ **results.snippet** (`string`): Content snippet.
119
+
120
+ **results.date** (`string`): Publication date when available.
121
+
122
+ ## Agent example
123
+
124
+ The following example registers the search tool on an agent so it can fetch fresh web results before answering.
125
+
126
+ ```typescript
127
+ import { Agent } from '@mastra/core/agent'
128
+ import { createPerplexitySearchTool } from '@mastra/perplexity'
129
+
130
+ const agent = new Agent({
131
+ id: 'research-agent',
132
+ name: 'Research Agent',
133
+ model: 'anthropic/claude-sonnet-4-6',
134
+ instructions:
135
+ 'You are a research assistant. Use the perplexity-search tool to find up-to-date information from the web before answering.',
136
+ tools: {
137
+ search: createPerplexitySearchTool(),
138
+ },
139
+ })
140
+ ```
141
+
142
+ ## Environment variables
143
+
144
+ | Variable | Description |
145
+ | -------------------- | ----------------------------------------------------------------------------------------------- |
146
+ | `PERPLEXITY_API_KEY` | Your Perplexity API key. Used as the default when `apiKey` is not passed to a factory function. |
147
+ | `PPLX_API_KEY` | Fallback used when `PERPLEXITY_API_KEY` is unset. |
148
+
149
+ ## Related
150
+
151
+ - [`createTool()`](https://mastra.ai/reference/tools/create-tool)
152
+ - [Perplexity Search quickstart](https://docs.perplexity.ai/docs/search/quickstart)
153
+ - [Perplexity Agent quickstart](https://docs.perplexity.ai/docs/agent/quickstart)
154
+ - [Perplexity model provider](https://mastra.ai/models/providers/perplexity)
155
+ - [Perplexity Agent provider](https://mastra.ai/models/providers/perplexity-agent)