@mastra/mcp-docs-server 0.13.38 → 0.13.39-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.
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fauth.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +20 -20
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Frag.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Freact.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +18 -18
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +11 -1
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
- package/.docs/organized/changelogs/create-mastra.md +7 -7
- package/.docs/organized/changelogs/mastra.md +18 -18
- package/.docs/raw/agents/overview.mdx +2 -2
- package/.docs/raw/auth/jwt.mdx +2 -2
- package/.docs/raw/auth/supabase.mdx +2 -2
- package/.docs/raw/auth/workos.mdx +2 -2
- package/.docs/raw/course/02-agent-tools-mcp/04-initializing-mcp-tools.md +2 -2
- package/.docs/raw/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +1 -1
- package/.docs/raw/frameworks/agentic-uis/ai-sdk.mdx +24 -8
- package/.docs/raw/frameworks/agentic-uis/openrouter.mdx +1 -1
- package/.docs/raw/frameworks/servers/express.mdx +1 -1
- package/.docs/raw/frameworks/web-frameworks/sveltekit.mdx +34 -18
- package/.docs/raw/getting-started/installation.mdx +7 -7
- package/.docs/raw/getting-started/mcp-docs-server.mdx +1 -1
- package/.docs/raw/getting-started/studio.mdx +27 -17
- package/.docs/raw/getting-started/templates.mdx +12 -4
- package/.docs/raw/index.mdx +1 -1
- package/.docs/raw/mastra-cloud/dashboard.mdx +6 -6
- package/.docs/raw/mastra-cloud/observability.mdx +2 -2
- package/.docs/raw/mastra-cloud/overview.mdx +1 -1
- package/.docs/raw/mastra-cloud/setting-up.mdx +1 -1
- package/.docs/raw/memory/overview.mdx +1 -1
- package/.docs/raw/memory/semantic-recall.mdx +2 -4
- package/.docs/raw/memory/threads-and-resources.mdx +1 -1
- package/.docs/raw/memory/working-memory.mdx +1 -1
- package/.docs/raw/observability/ai-tracing/exporters/default.mdx +6 -6
- package/.docs/raw/observability/ai-tracing/overview.mdx +7 -7
- package/.docs/raw/observability/overview.mdx +1 -1
- package/.docs/raw/reference/agents/agent.mdx +2 -2
- package/.docs/raw/reference/agents/listScorers.mdx +69 -0
- package/.docs/raw/reference/agents/listTools.mdx +69 -0
- package/.docs/raw/reference/agents/listWorkflows.mdx +69 -0
- package/.docs/raw/reference/cli/mastra.mdx +1 -1
- package/.docs/raw/reference/client-js/agents.mdx +1 -1
- package/.docs/raw/reference/client-js/logs.mdx +1 -1
- package/.docs/raw/reference/client-js/mastra-client.mdx +7 -7
- package/.docs/raw/reference/client-js/memory.mdx +1 -1
- package/.docs/raw/reference/client-js/tools.mdx +1 -1
- package/.docs/raw/reference/client-js/workflows.mdx +1 -1
- package/.docs/raw/reference/core/getScorerByName.mdx +1 -1
- package/.docs/raw/reference/core/listAgents.mdx +35 -0
- package/.docs/raw/reference/core/listLogs.mdx +96 -0
- package/.docs/raw/reference/core/listLogsByRunId.mdx +87 -0
- package/.docs/raw/reference/core/listScorers.mdx +43 -0
- package/.docs/raw/reference/core/listWorkflows.mdx +45 -0
- package/.docs/raw/reference/memory/memory-class.mdx +2 -1
- package/.docs/raw/reference/observability/ai-tracing/ai-tracing.mdx +0 -1
- package/.docs/raw/reference/observability/ai-tracing/interfaces.mdx +1 -1
- package/.docs/raw/reference/observability/otel-tracing/providers/keywordsai.mdx +1 -1
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +10 -14
- package/.docs/raw/reference/processors/language-detector.mdx +20 -32
- package/.docs/raw/reference/processors/moderation-processor.mdx +46 -30
- package/.docs/raw/reference/processors/pii-detector.mdx +47 -32
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +20 -30
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +24 -29
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +14 -23
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +12 -14
- package/.docs/raw/reference/rag/document.mdx +1 -1
- package/.docs/raw/reference/scorers/run-experiment.mdx +1 -1
- package/.docs/raw/reference/storage/mssql.mdx +3 -3
- package/.docs/raw/reference/streaming/workflows/resumeStreamVNext.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/streamVNext.mdx +1 -1
- package/.docs/raw/reference/tools/mcp-client.mdx +8 -8
- package/.docs/raw/reference/voice/google-gemini-live.mdx +1 -1
- package/.docs/raw/reference/workflows/step.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +72 -2
- package/.docs/raw/reference/workflows/workflow.mdx +0 -14
- package/.docs/raw/scorers/overview.mdx +5 -5
- package/.docs/raw/server-db/middleware.mdx +4 -4
- package/.docs/raw/tools-mcp/overview.mdx +2 -2
- package/.docs/raw/workflows/agents-and-tools.mdx +2 -6
- package/.docs/raw/workflows/control-flow.mdx +208 -165
- package/.docs/raw/workflows/inngest-workflow.mdx +2 -2
- package/.docs/raw/workflows/overview.mdx +106 -54
- package/.docs/raw/workflows/suspend-and-resume.mdx +1 -9
- package/CHANGELOG.md +10 -0
- package/package.json +4 -4
- package/.docs/raw/workflows/input-data-mapping.mdx +0 -107
|
@@ -31,7 +31,7 @@ const storage = new MSSQLStore({
|
|
|
31
31
|
name: "connectionString",
|
|
32
32
|
type: "string",
|
|
33
33
|
description:
|
|
34
|
-
"MSSQL connection string (e.g.,
|
|
34
|
+
"MSSQL connection string (e.g., Server=localhost,1433;Database=mydb;User Id=sa;Password=password;Encrypt=true;TrustServerCertificate=true)",
|
|
35
35
|
isOptional: false,
|
|
36
36
|
},
|
|
37
37
|
{
|
|
@@ -53,12 +53,12 @@ import { MSSQLStore } from "@mastra/mssql";
|
|
|
53
53
|
|
|
54
54
|
// Using a connection string only
|
|
55
55
|
const store1 = new MSSQLStore({
|
|
56
|
-
connectionString: "
|
|
56
|
+
connectionString: "Server=localhost,1433;Database=mydb;User Id=sa;Password=password;Encrypt=true;TrustServerCertificate=true",
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// Using a connection string with a custom schema name
|
|
60
60
|
const store2 = new MSSQLStore({
|
|
61
|
-
connectionString: "
|
|
61
|
+
connectionString: "Server=localhost,1433;Database=mydb;User Id=sa;Password=password;Encrypt=true;TrustServerCertificate=true",
|
|
62
62
|
schemaName: "custom_schema", // optional
|
|
63
63
|
});
|
|
64
64
|
|
|
@@ -46,7 +46,7 @@ if (result!.status === "suspended") {
|
|
|
46
46
|
{
|
|
47
47
|
name: "runtimeContext",
|
|
48
48
|
type: "RuntimeContext",
|
|
49
|
-
description: "
|
|
49
|
+
description: "Request Context data to use during workflow execution",
|
|
50
50
|
isOptional: true,
|
|
51
51
|
},
|
|
52
52
|
{
|
|
@@ -32,7 +32,7 @@ const { stream } = await run.stream({
|
|
|
32
32
|
{
|
|
33
33
|
name: "runtimeContext",
|
|
34
34
|
type: "RuntimeContext",
|
|
35
|
-
description: "
|
|
35
|
+
description: "Request Context data to use during workflow execution",
|
|
36
36
|
isOptional: true,
|
|
37
37
|
},
|
|
38
38
|
{
|
|
@@ -36,7 +36,7 @@ const stream = run.streamVNext({
|
|
|
36
36
|
{
|
|
37
37
|
name: "runtimeContext",
|
|
38
38
|
type: "RuntimeContext",
|
|
39
|
-
description: "
|
|
39
|
+
description: "Request Context data to use during workflow execution",
|
|
40
40
|
isOptional: true,
|
|
41
41
|
},
|
|
42
42
|
{
|
|
@@ -129,23 +129,23 @@ Each server in the `servers` map is configured using the `MastraMCPServerDefinit
|
|
|
129
129
|
|
|
130
130
|
## Methods
|
|
131
131
|
|
|
132
|
-
###
|
|
132
|
+
### listTools()
|
|
133
133
|
|
|
134
134
|
Retrieves all tools from all configured servers, with tool names namespaced by their server name (in the format `serverName_toolName`) to prevent conflicts.
|
|
135
135
|
Intended to be passed onto an Agent definition.
|
|
136
136
|
|
|
137
137
|
```ts
|
|
138
|
-
new Agent({ tools: await mcp.
|
|
138
|
+
new Agent({ tools: await mcp.listTools() });
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
###
|
|
141
|
+
### listToolsets()
|
|
142
142
|
|
|
143
143
|
Returns an object mapping namespaced tool names (in the format `serverName.toolName`) to their tool implementations.
|
|
144
144
|
Intended to be passed dynamically into the generate or stream method.
|
|
145
145
|
|
|
146
146
|
```typescript
|
|
147
147
|
const res = await agent.stream(prompt, {
|
|
148
|
-
toolsets: await mcp.
|
|
148
|
+
toolsets: await mcp.listToolsets(),
|
|
149
149
|
});
|
|
150
150
|
```
|
|
151
151
|
|
|
@@ -627,7 +627,7 @@ await mcpClient.elicitation.onRequest("interactiveServer", async (request) => {
|
|
|
627
627
|
|
|
628
628
|
### Static Tool Configuration
|
|
629
629
|
|
|
630
|
-
For tools where you have a single connection to the MCP server for you entire app, use `
|
|
630
|
+
For tools where you have a single connection to the MCP server for you entire app, use `listTools()` and pass the tools to your agent:
|
|
631
631
|
|
|
632
632
|
```typescript
|
|
633
633
|
import { MCPClient } from "@mastra/mcp";
|
|
@@ -658,7 +658,7 @@ const agent = new Agent({
|
|
|
658
658
|
name: "Multi-tool Agent",
|
|
659
659
|
instructions: "You have access to multiple tool servers.",
|
|
660
660
|
model: openai("gpt-4"),
|
|
661
|
-
tools: await mcp.
|
|
661
|
+
tools: await mcp.listTools(),
|
|
662
662
|
});
|
|
663
663
|
|
|
664
664
|
// Example of using resource methods
|
|
@@ -702,7 +702,7 @@ checkWeatherPrompt();
|
|
|
702
702
|
|
|
703
703
|
### Dynamic toolsets
|
|
704
704
|
|
|
705
|
-
When you need a new MCP connection for each user, use `
|
|
705
|
+
When you need a new MCP connection for each user, use `listToolsets()` and add the tools when calling stream or generate:
|
|
706
706
|
|
|
707
707
|
```typescript
|
|
708
708
|
import { Agent } from "@mastra/core/agent";
|
|
@@ -742,7 +742,7 @@ const mcp = new MCPClient({
|
|
|
742
742
|
const response = await agent.stream(
|
|
743
743
|
"How is AAPL doing and what is the weather?",
|
|
744
744
|
{
|
|
745
|
-
toolsets: await mcp.
|
|
745
|
+
toolsets: await mcp.listToolsets(),
|
|
746
746
|
},
|
|
747
747
|
);
|
|
748
748
|
```
|
|
@@ -220,7 +220,7 @@ Establishes a connection to the Gemini Live API. Must be called before using spe
|
|
|
220
220
|
{
|
|
221
221
|
name: "runtimeContext",
|
|
222
222
|
type: "object",
|
|
223
|
-
description: "Optional
|
|
223
|
+
description: "Optional request context for the connection.",
|
|
224
224
|
isOptional: true,
|
|
225
225
|
},
|
|
226
226
|
{
|
|
@@ -140,7 +140,7 @@ const step1 = createStep({
|
|
|
140
140
|
type: "RuntimeContext",
|
|
141
141
|
isOptional: true,
|
|
142
142
|
description:
|
|
143
|
-
"Runtime
|
|
143
|
+
"Runtime Context for dependency injection and contextual information.",
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
name: "runCount",
|
|
@@ -39,6 +39,76 @@ workflow.map(async ({ inputData }) => `${inputData.value} - map`
|
|
|
39
39
|
]}
|
|
40
40
|
/>
|
|
41
41
|
|
|
42
|
-
##
|
|
42
|
+
## Using `inputData`
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
Use `inputData` to access the full output of the previous step.
|
|
45
|
+
|
|
46
|
+
```typescript {3} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
47
|
+
.then(step1)
|
|
48
|
+
.map(({ inputData }) => {
|
|
49
|
+
console.log(inputData);
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Using `getStepResult()`
|
|
54
|
+
|
|
55
|
+
Use `getStepResult()` to access the full output of a specific step by referencing the step's instance.
|
|
56
|
+
|
|
57
|
+
```typescript {3} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
58
|
+
.then(step1)
|
|
59
|
+
.map(async ({ getStepResult }) => {
|
|
60
|
+
console.log(getStepResult(step1));
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Using `getInitData()`
|
|
65
|
+
|
|
66
|
+
Use `getInitData()` to access the initial input data provided to the workflow.
|
|
67
|
+
|
|
68
|
+
```typescript {3} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
69
|
+
.then(step1)
|
|
70
|
+
.map(async ({ getInitData }) => {
|
|
71
|
+
console.log(getInitData());
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Using `mapVariable()`
|
|
76
|
+
|
|
77
|
+
The object form of `.map()` provides an alternative declarative syntax for mapping fields. Instead of writing a function, you define an object where each key is a new field name and each value uses `mapVariable()` to extract data from previous steps or workflow input.
|
|
78
|
+
Import `mapVariable()` from the workflows module:
|
|
79
|
+
|
|
80
|
+
```typescript filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
81
|
+
import { mapVariable } from "@mastra/core/workflows";
|
|
82
|
+
```
|
|
83
|
+
### Extracting fields from step outputs
|
|
84
|
+
|
|
85
|
+
Use `mapVariable()` with `step` to extract a specific field from a step's output and map it to a new field name. The `path` parameter specifies which field to extract.
|
|
86
|
+
In this example, the `value` field from `step1`'s output is extracted and mapped to a new field called `details`:
|
|
87
|
+
|
|
88
|
+
```typescript {3-6} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
89
|
+
.then(step1)
|
|
90
|
+
.map({
|
|
91
|
+
details: mapVariable({
|
|
92
|
+
step: step1,
|
|
93
|
+
path: "value"
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Extracting fields from workflow input
|
|
99
|
+
|
|
100
|
+
Use `mapVariable()` with `initData` to extract a specific field from the workflow's initial input data. This is useful when you need to pass the original workflow input to a later step.
|
|
101
|
+
In this example, the `value` field from the workflow's input is extracted and mapped to a field called `details`:
|
|
102
|
+
|
|
103
|
+
```typescript {6-9} filename="src/mastra/workflows/test-workflow.ts" showLineNumbers copy
|
|
104
|
+
export const testWorkflow = createWorkflow({...});
|
|
105
|
+
|
|
106
|
+
testWorkflow
|
|
107
|
+
.then(step1)
|
|
108
|
+
.map({
|
|
109
|
+
details: mapVariable({
|
|
110
|
+
initData: testWorkflow,
|
|
111
|
+
path: "value"
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
```
|
|
@@ -115,20 +115,6 @@ A workflow's `status` indicates its current execution state. The possible values
|
|
|
115
115
|
]}
|
|
116
116
|
/>
|
|
117
117
|
|
|
118
|
-
## Extended usage example
|
|
119
|
-
|
|
120
|
-
```typescript title="src/test-run.ts" showLineNumbers copy
|
|
121
|
-
import { mastra } from "./mastra";
|
|
122
|
-
|
|
123
|
-
const run = await mastra.getWorkflow("workflow").createRunAsync();
|
|
124
|
-
|
|
125
|
-
const result = await run.start({...});
|
|
126
|
-
|
|
127
|
-
if (result.status === "suspended") {
|
|
128
|
-
const resumedResult = await run.resume({...});
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
118
|
## Related
|
|
133
119
|
|
|
134
120
|
- [Step Class](./step)
|
|
@@ -110,7 +110,7 @@ To score traces, you must first configure observability in your Mastra instance
|
|
|
110
110
|
|
|
111
111
|
:::
|
|
112
112
|
|
|
113
|
-
### Scoring traces with
|
|
113
|
+
### Scoring traces with Studio
|
|
114
114
|
|
|
115
115
|
To score traces, you first need to register your scorers with your Mastra instance:
|
|
116
116
|
|
|
@@ -124,16 +124,16 @@ const mastra = new Mastra({
|
|
|
124
124
|
});
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
Once registered, you can score traces interactively within
|
|
127
|
+
Once registered, you can score traces interactively within Studio under the Observability section. This provides a user-friendly interface for running scorers against historical traces.
|
|
128
128
|
|
|
129
129
|
## Testing scorers locally
|
|
130
130
|
|
|
131
|
-
Mastra provides a CLI command `mastra dev` to test your scorers.
|
|
131
|
+
Mastra provides a CLI command `mastra dev` to test your scorers. Studio includes a scorers section where you can run individual scorers against test inputs and view detailed results.
|
|
132
132
|
|
|
133
|
-
For more details, see
|
|
133
|
+
For more details, see [Studio](/docs/getting-started/studio) docs.
|
|
134
134
|
|
|
135
135
|
## Next steps
|
|
136
136
|
|
|
137
137
|
- Learn how to create your own scorers in the [Creating Custom Scorers](/docs/scorers/custom-scorers) guide
|
|
138
138
|
- Explore built-in scorers in the [Off-the-shelf Scorers](/docs/scorers/off-the-shelf-scorers) section
|
|
139
|
-
- Test scorers with
|
|
139
|
+
- Test scorers with [Studio](/docs/getting-started/studio)
|
|
@@ -121,15 +121,15 @@ registerApiRoute("/my-custom-route", {
|
|
|
121
121
|
### Special Mastra headers
|
|
122
122
|
|
|
123
123
|
When integrating with Mastra Cloud or custom clients the following headers can
|
|
124
|
-
be inspected by middleware to tailor
|
|
124
|
+
be inspected by middleware to tailor behavior:
|
|
125
125
|
|
|
126
126
|
```typescript copy
|
|
127
127
|
{
|
|
128
128
|
handler: async (c, next) => {
|
|
129
129
|
const isFromMastraCloud = c.req.header('x-mastra-cloud') === 'true';
|
|
130
130
|
const clientType = c.req.header('x-mastra-client-type');
|
|
131
|
-
const
|
|
132
|
-
c.req.header('x-
|
|
131
|
+
const isStudio =
|
|
132
|
+
c.req.header('x-studio') === 'true';
|
|
133
133
|
|
|
134
134
|
if (isFromMastraCloud) {
|
|
135
135
|
// Special handling
|
|
@@ -141,7 +141,7 @@ be inspected by middleware to tailor behaviour:
|
|
|
141
141
|
|
|
142
142
|
- `x-mastra-cloud`: request originates from Mastra Cloud
|
|
143
143
|
- `x-mastra-client-type`: identifies the client SDK, e.g. `js` or `python`
|
|
144
|
-
- `x-
|
|
144
|
+
- `x-studio`: request triggered from Studio
|
|
145
145
|
|
|
146
146
|
### Setting `runtimeContext`
|
|
147
147
|
|
|
@@ -83,6 +83,6 @@ export const testTool = createTool({
|
|
|
83
83
|
|
|
84
84
|
> See [Runtime Context](/docs/server-db/runtime-context) for more information.
|
|
85
85
|
|
|
86
|
-
## Testing with
|
|
86
|
+
## Testing with Studio
|
|
87
87
|
|
|
88
|
-
Use
|
|
88
|
+
Use [Studio](/docs/getting-started/studio) to test tools with different inputs, inspect execution results, and verify tool behavior.
|
|
@@ -39,8 +39,6 @@ const step1 = createStep({
|
|
|
39
39
|
});
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
> See [Calling Agents](/examples/agents/calling-agents) for more examples.
|
|
43
|
-
|
|
44
42
|
### Agents as steps
|
|
45
43
|
|
|
46
44
|
Compose an agent as a step using `createStep()` when you don't need to modify the agent call. Use `.map()` to transform the previous step's output into a `prompt` the agent can use.
|
|
@@ -66,7 +64,7 @@ export const testWorkflow = createWorkflow({
|
|
|
66
64
|
.commit();
|
|
67
65
|
```
|
|
68
66
|
|
|
69
|
-
> See [
|
|
67
|
+
> See [.map()](/reference/workflows/workflow-methods/map) for more information.
|
|
70
68
|
|
|
71
69
|
Mastra agents use a default schema that expects a `prompt` string as input and returns a `text` string as output:
|
|
72
70
|
|
|
@@ -111,8 +109,6 @@ const step2 = createStep({
|
|
|
111
109
|
});
|
|
112
110
|
```
|
|
113
111
|
|
|
114
|
-
> See [Calling Tools](/examples/workflows_legacy/using-a-tool-as-a-step) for more examples.
|
|
115
|
-
|
|
116
112
|
### Tools as steps
|
|
117
113
|
|
|
118
114
|
Compose a tool as a step using `createStep()` when the previous step's output matches the tool's input context. You can use `.map()` to transform the previous step's output if they don't.
|
|
@@ -138,7 +134,7 @@ export const testWorkflow = createWorkflow({
|
|
|
138
134
|
.commit();
|
|
139
135
|
```
|
|
140
136
|
|
|
141
|
-
> See [
|
|
137
|
+
> See [.map()](/reference/workflows/workflow-methods/map) for more information.
|
|
142
138
|
|
|
143
139
|
## Related
|
|
144
140
|
|