@mastra/mcp-docs-server 1.1.35-alpha.2 → 1.1.35-alpha.21
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/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +48 -4
- package/.docs/docs/agents/background-tasks.md +62 -2
- package/.docs/docs/agents/processors.md +34 -2
- package/.docs/docs/agents/response-caching.md +148 -0
- package/.docs/docs/agents/using-tools.md +8 -0
- package/.docs/docs/editor/tools.md +1 -1
- package/.docs/docs/index.md +2 -2
- package/.docs/docs/mastra-platform/configuration.md +1 -1
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/memory/observational-memory.md +63 -14
- package/.docs/docs/memory/overview.md +2 -1
- package/.docs/docs/memory/semantic-recall.md +68 -6
- package/.docs/docs/observability/logging.md +2 -2
- package/.docs/docs/observability/metrics/overview.md +4 -4
- package/.docs/docs/observability/overview.md +6 -6
- package/.docs/docs/observability/tracing/bridges/otel.md +25 -0
- package/.docs/docs/observability/tracing/exporters/arize.md +5 -5
- package/.docs/docs/observability/tracing/exporters/braintrust.md +37 -0
- package/.docs/docs/observability/tracing/exporters/langfuse.md +21 -0
- package/.docs/docs/observability/tracing/exporters/{cloud.md → mastra-platform.md} +28 -26
- package/.docs/docs/observability/tracing/exporters/{default.md → mastra-storage.md} +56 -19
- package/.docs/docs/observability/tracing/exporters/otel.md +79 -2
- package/.docs/docs/observability/tracing/overview.md +30 -29
- package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +6 -6
- package/.docs/docs/server/mastra-server.md +30 -19
- package/.docs/docs/studio/observability.md +4 -4
- package/.docs/docs/studio/overview.md +4 -0
- package/.docs/docs/workflows/suspend-and-resume.md +28 -1
- package/.docs/guides/deployment/inngest.md +29 -8
- package/.docs/guides/guide/web-search.md +7 -7
- package/.docs/guides/migrations/mastra-cloud.md +6 -6
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +19 -17
- package/.docs/models/gateways/azure-openai.md +94 -23
- package/.docs/models/gateways/netlify.md +3 -1
- package/.docs/models/gateways/openrouter.md +5 -1
- package/.docs/models/gateways/vercel.md +2 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/deepinfra.md +2 -1
- package/.docs/models/providers/deepseek.md +3 -1
- package/.docs/models/providers/digitalocean.md +10 -2
- package/.docs/models/providers/firepass.md +71 -0
- package/.docs/models/providers/google.md +3 -2
- package/.docs/models/providers/kilo.md +5 -3
- package/.docs/models/providers/kiro.md +110 -0
- package/.docs/models/providers/llmgateway.md +8 -2
- package/.docs/models/providers/nebius.md +37 -55
- package/.docs/models/providers/openai.md +2 -0
- package/.docs/models/providers/opencode-go.md +2 -4
- package/.docs/models/providers/opencode.md +3 -3
- package/.docs/models/providers/poe.md +4 -1
- package/.docs/models/providers/qiniu-ai.md +2 -2
- package/.docs/models/providers/wafer.ai.md +2 -1
- package/.docs/models/providers/xiaomi-token-plan-ams.md +6 -5
- package/.docs/models/providers/xiaomi-token-plan-cn.md +6 -5
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +6 -5
- package/.docs/models/providers/xiaomi.md +2 -2
- package/.docs/models/providers/zenmux.md +1 -1
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/agents/agent.md +2 -0
- package/.docs/reference/cli/mastra.md +464 -0
- package/.docs/reference/client-js/agents.md +26 -1
- package/.docs/reference/client-js/responses.md +4 -0
- package/.docs/reference/configuration.md +6 -6
- package/.docs/reference/editor/tool-provider.md +3 -3
- package/.docs/reference/harness/harness-class.md +23 -8
- package/.docs/reference/index.md +3 -0
- package/.docs/reference/memory/observational-memory.md +11 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +2 -4
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/bridges/otel.md +26 -4
- package/.docs/reference/observability/tracing/configuration.md +6 -3
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/braintrust.md +2 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -1
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +2 -2
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +7 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +263 -0
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +194 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +12 -8
- package/.docs/reference/observability/tracing/instances.md +2 -2
- package/.docs/reference/observability/tracing/interfaces.md +37 -2
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +22 -0
- package/.docs/reference/observability/tracing/span-filtering.md +2 -2
- package/.docs/reference/processors/processor-interface.md +74 -12
- package/.docs/reference/processors/provider-history-compat.md +132 -0
- package/.docs/reference/processors/response-cache.md +114 -0
- package/.docs/reference/processors/tool-call-filter.md +28 -0
- package/.docs/reference/storage/clickhouse.md +8 -8
- package/.docs/reference/storage/cloudflare-d1.md +1 -1
- package/.docs/reference/storage/cloudflare.md +1 -1
- package/.docs/reference/storage/composite.md +1 -1
- package/.docs/reference/storage/convex.md +1 -1
- package/.docs/reference/storage/duckdb.md +3 -3
- package/.docs/reference/storage/dynamodb.md +1 -1
- package/.docs/reference/storage/lance.md +1 -1
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/postgresql.md +1 -1
- package/.docs/reference/storage/upstash.md +1 -1
- package/.docs/reference/streaming/ChunkType.md +44 -0
- package/.docs/reference/streaming/agents/stream.md +18 -2
- package/.docs/reference/tools/create-tool.md +46 -0
- package/.docs/reference/tools/mcp-client.md +47 -0
- package/.docs/reference/workflows/workflow-state-reader.md +113 -0
- package/CHANGELOG.md +71 -0
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Xiaomi Token Plan (China)
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 6 Xiaomi Token Plan (China) models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Xiaomi Token Plan (China) documentation](https://platform.xiaomimimo.com/#/docs).
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ const agent = new Agent({
|
|
|
15
15
|
id: "my-agent",
|
|
16
16
|
name: "My Agent",
|
|
17
17
|
instructions: "You are a helpful assistant",
|
|
18
|
-
model: "xiaomi-token-plan-cn/mimo-v2-
|
|
18
|
+
model: "xiaomi-token-plan-cn/mimo-v2-flash"
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// Generate a response
|
|
@@ -34,7 +34,8 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
36
|
| ------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
-
| `xiaomi-token-plan-cn/mimo-v2-
|
|
37
|
+
| `xiaomi-token-plan-cn/mimo-v2-flash` | 262K | | | | | | — | — |
|
|
38
|
+
| `xiaomi-token-plan-cn/mimo-v2-omni` | 262K | | | | | | — | — |
|
|
38
39
|
| `xiaomi-token-plan-cn/mimo-v2-pro` | 1.0M | | | | | | — | — |
|
|
39
40
|
| `xiaomi-token-plan-cn/mimo-v2-tts` | 8K | | | | | | — | — |
|
|
40
41
|
| `xiaomi-token-plan-cn/mimo-v2.5` | 1.0M | | | | | | — | — |
|
|
@@ -50,7 +51,7 @@ const agent = new Agent({
|
|
|
50
51
|
name: "custom-agent",
|
|
51
52
|
model: {
|
|
52
53
|
url: "https://token-plan-cn.xiaomimimo.com/v1",
|
|
53
|
-
id: "xiaomi-token-plan-cn/mimo-v2-
|
|
54
|
+
id: "xiaomi-token-plan-cn/mimo-v2-flash",
|
|
54
55
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
55
56
|
headers: {
|
|
56
57
|
"X-Custom-Header": "value"
|
|
@@ -69,7 +70,7 @@ const agent = new Agent({
|
|
|
69
70
|
const useAdvanced = requestContext.task === "complex";
|
|
70
71
|
return useAdvanced
|
|
71
72
|
? "xiaomi-token-plan-cn/mimo-v2.5-pro"
|
|
72
|
-
: "xiaomi-token-plan-cn/mimo-v2-
|
|
73
|
+
: "xiaomi-token-plan-cn/mimo-v2-flash";
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Xiaomi Token Plan (Singapore)
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 6 Xiaomi Token Plan (Singapore) models through Mastra's model router. Authentication is handled automatically using the `XIAOMI_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Xiaomi Token Plan (Singapore) documentation](https://platform.xiaomimimo.com/#/docs).
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ const agent = new Agent({
|
|
|
15
15
|
id: "my-agent",
|
|
16
16
|
name: "My Agent",
|
|
17
17
|
instructions: "You are a helpful assistant",
|
|
18
|
-
model: "xiaomi-token-plan-sgp/mimo-v2-
|
|
18
|
+
model: "xiaomi-token-plan-sgp/mimo-v2-flash"
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// Generate a response
|
|
@@ -34,7 +34,8 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
36
|
| ------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
-
| `xiaomi-token-plan-sgp/mimo-v2-
|
|
37
|
+
| `xiaomi-token-plan-sgp/mimo-v2-flash` | 262K | | | | | | — | — |
|
|
38
|
+
| `xiaomi-token-plan-sgp/mimo-v2-omni` | 262K | | | | | | — | — |
|
|
38
39
|
| `xiaomi-token-plan-sgp/mimo-v2-pro` | 1.0M | | | | | | — | — |
|
|
39
40
|
| `xiaomi-token-plan-sgp/mimo-v2-tts` | 8K | | | | | | — | — |
|
|
40
41
|
| `xiaomi-token-plan-sgp/mimo-v2.5` | 1.0M | | | | | | — | — |
|
|
@@ -50,7 +51,7 @@ const agent = new Agent({
|
|
|
50
51
|
name: "custom-agent",
|
|
51
52
|
model: {
|
|
52
53
|
url: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
53
|
-
id: "xiaomi-token-plan-sgp/mimo-v2-
|
|
54
|
+
id: "xiaomi-token-plan-sgp/mimo-v2-flash",
|
|
54
55
|
apiKey: process.env.XIAOMI_API_KEY,
|
|
55
56
|
headers: {
|
|
56
57
|
"X-Custom-Header": "value"
|
|
@@ -69,7 +70,7 @@ const agent = new Agent({
|
|
|
69
70
|
const useAdvanced = requestContext.task === "complex";
|
|
70
71
|
return useAdvanced
|
|
71
72
|
? "xiaomi-token-plan-sgp/mimo-v2.5-pro"
|
|
72
|
-
: "xiaomi-token-plan-sgp/mimo-v2-
|
|
73
|
+
: "xiaomi-token-plan-sgp/mimo-v2-flash";
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
```
|
|
@@ -34,8 +34,8 @@ for await (const chunk of stream) {
|
|
|
34
34
|
|
|
35
35
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
36
|
| ---------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
-
| `xiaomi/mimo-v2-flash` |
|
|
38
|
-
| `xiaomi/mimo-v2-omni` |
|
|
37
|
+
| `xiaomi/mimo-v2-flash` | 262K | | | | | | $0.10 | $0.30 |
|
|
38
|
+
| `xiaomi/mimo-v2-omni` | 262K | | | | | | $0.40 | $2 |
|
|
39
39
|
| `xiaomi/mimo-v2-pro` | 1.0M | | | | | | $1 | $3 |
|
|
40
40
|
| `xiaomi/mimo-v2.5` | 1.0M | | | | | | $0.40 | $2 |
|
|
41
41
|
| `xiaomi/mimo-v2.5-pro` | 1.0M | | | | | | $1 | $3 |
|
|
@@ -114,7 +114,7 @@ for await (const chunk of stream) {
|
|
|
114
114
|
| `zenmux/x-ai/grok-code-fast-1` | 256K | | | | | | $0.20 | $2 |
|
|
115
115
|
| `zenmux/xiaomi/mimo-v2-flash` | 262K | | | | | | $0.10 | $0.30 |
|
|
116
116
|
| `zenmux/xiaomi/mimo-v2-omni` | 265K | | | | | | $0.40 | $2 |
|
|
117
|
-
| `zenmux/xiaomi/mimo-v2-pro` | 1.0M | | | | | | $
|
|
117
|
+
| `zenmux/xiaomi/mimo-v2-pro` | 1.0M | | | | | | $1 | $3 |
|
|
118
118
|
| `zenmux/xiaomi/mimo-v2.5` | 1.0M | | | | | | $0.40 | $2 |
|
|
119
119
|
| `zenmux/xiaomi/mimo-v2.5-pro` | 1.0M | | | | | | $1 | $3 |
|
|
120
120
|
| `zenmux/z-ai/glm-4.5` | 128K | | | | | | $0.35 | $2 |
|
|
@@ -31,6 +31,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
31
31
|
- [DInference](https://mastra.ai/models/providers/dinference)
|
|
32
32
|
- [evroc](https://mastra.ai/models/providers/evroc)
|
|
33
33
|
- [FastRouter](https://mastra.ai/models/providers/fastrouter)
|
|
34
|
+
- [Fireworks (Firepass)](https://mastra.ai/models/providers/firepass)
|
|
34
35
|
- [Fireworks AI](https://mastra.ai/models/providers/fireworks-ai)
|
|
35
36
|
- [Friendli](https://mastra.ai/models/providers/friendli)
|
|
36
37
|
- [FrogBot](https://mastra.ai/models/providers/frogbot)
|
|
@@ -110,6 +110,8 @@ export const agent = new Agent({
|
|
|
110
110
|
|
|
111
111
|
**tools** (`ToolsInput | ({ requestContext: RequestContext }) => ToolsInput | Promise<ToolsInput>`): Tools that the agent can access. Can be provided statically or resolved dynamically.
|
|
112
112
|
|
|
113
|
+
**transform** (`ToolPayloadTransformPolicy`): Shared policy for transforming tool payloads before display streams or user-visible transcript messages receive them. Use per-tool \`transform\` on \`createTool()\` for tool-local rules.
|
|
114
|
+
|
|
113
115
|
**workflows** (`Record<string, Workflow> | ({ requestContext: RequestContext }) => Record<string, Workflow> | Promise<Record<string, Workflow>>`): Workflows that the agent can execute. Can be static or dynamically resolved.
|
|
114
116
|
|
|
115
117
|
**defaultOptions** (`AgentExecutionOptions | ({ requestContext: RequestContext }) => AgentExecutionOptions | Promise<AgentExecutionOptions>`): Default options used when calling \`stream()\` and \`generate()\`.
|
|
@@ -550,6 +550,470 @@ See the [Storage migration guide](https://mastra.ai/guides/migrations/upgrade-to
|
|
|
550
550
|
|
|
551
551
|
It accepts [common flags](#common-flags).
|
|
552
552
|
|
|
553
|
+
## `mastra api`
|
|
554
|
+
|
|
555
|
+
Calls a Mastra runtime server with JSON input and JSON output. Use it for local development servers, deployed Mastra Platform projects, or self-hosted Mastra servers.
|
|
556
|
+
|
|
557
|
+
```bash
|
|
558
|
+
mastra api agent list --pretty
|
|
559
|
+
mastra api agent run weather-agent '{"messages":"What is the weather in London?"}'
|
|
560
|
+
mastra api tool execute get-weather '{"location":"San Francisco"}'
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
Use `mastra api <resource> <action> --help` to see examples for a command.
|
|
564
|
+
|
|
565
|
+
### Output
|
|
566
|
+
|
|
567
|
+
Success responses are written to `stdout` as JSON. Single-resource commands return:
|
|
568
|
+
|
|
569
|
+
```json
|
|
570
|
+
{ "data": {} }
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
List commands return a `data` array and pagination metadata:
|
|
574
|
+
|
|
575
|
+
```json
|
|
576
|
+
{ "data": [], "page": { "total": 0, "page": 0, "perPage": 0, "hasMore": false } }
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
Errors are written to `stderr` as JSON and return a non-zero exit code:
|
|
580
|
+
|
|
581
|
+
```json
|
|
582
|
+
{
|
|
583
|
+
"error": {
|
|
584
|
+
"code": "SERVER_UNREACHABLE",
|
|
585
|
+
"message": "Could not connect to target server",
|
|
586
|
+
"details": {}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### Target resolution
|
|
592
|
+
|
|
593
|
+
The command resolves the target server in this order:
|
|
594
|
+
|
|
595
|
+
1. `--url <url>` for an explicit remote or self-hosted server.
|
|
596
|
+
2. `http://localhost:4111` for a local `mastra dev` server.
|
|
597
|
+
3. `.mastra-project.json` for a Mastra Platform project.
|
|
598
|
+
|
|
599
|
+
Automatic platform auth is only used when the CLI resolves a Mastra Platform target from `.mastra-project.json`. Localhost targets and explicit `--url` targets do not receive automatic credentials. Headers passed with `--header` are sent to any target, including localhost.
|
|
600
|
+
|
|
601
|
+
### Flags
|
|
602
|
+
|
|
603
|
+
#### `--url <url>`
|
|
604
|
+
|
|
605
|
+
Target a specific Mastra server URL.
|
|
606
|
+
|
|
607
|
+
```bash
|
|
608
|
+
mastra api --url https://example.com agent list
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
#### `--header <"Key: Value">`
|
|
612
|
+
|
|
613
|
+
Send a custom HTTP header. Repeat the flag to send multiple headers.
|
|
614
|
+
|
|
615
|
+
```bash
|
|
616
|
+
mastra api --url https://example.com --header "Authorization: Bearer $TOKEN" agent list
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
#### `--timeout <ms>`
|
|
620
|
+
|
|
621
|
+
Set the request timeout in milliseconds. Defaults to `30000`. Workflow run start and resume commands default to `120000`.
|
|
622
|
+
|
|
623
|
+
#### `--pretty`
|
|
624
|
+
|
|
625
|
+
Pretty-print JSON output. Defaults to `false`.
|
|
626
|
+
|
|
627
|
+
#### `--schema`
|
|
628
|
+
|
|
629
|
+
Print the CLI-oriented request schema for a command that accepts JSON input. The schema comes from the target server's route contracts and includes the command shape, positionals, examples, request schemas, and response shape.
|
|
630
|
+
|
|
631
|
+
`--schema` is available on leaf commands that accept JSON input. It is not available as a top-level `mastra api` flag.
|
|
632
|
+
|
|
633
|
+
```bash
|
|
634
|
+
mastra api agent run --schema
|
|
635
|
+
mastra api tool execute --schema
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
### Input model
|
|
639
|
+
|
|
640
|
+
Commands that accept input take one inline JSON argument. Do not pass file paths or stdin.
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
mastra api workflow run start data-pipeline '{"inputData":{"source":"s3://bucket/data.csv"}}'
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
Use positional arguments for stable IDs and JSON for filters or payloads. For routes that require both query parameters and a request body, pass one JSON object. The CLI splits the input according to the server route schema.
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
mastra api thread create '{"agentId":"weather-agent","resourceId":"user_123","threadId":"thread_abc123","title":"Support conversation"}'
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
List commands accept `page` and `perPage` in the JSON input when the target route supports pagination:
|
|
653
|
+
|
|
654
|
+
```bash
|
|
655
|
+
mastra api score list '{"page":0,"perPage":50}'
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
### Get command-specific help
|
|
659
|
+
|
|
660
|
+
Each `mastra api` leaf command includes command-specific examples in its help output. Use `--help` on the exact command you want to call:
|
|
661
|
+
|
|
662
|
+
```bash
|
|
663
|
+
mastra api agent run --help
|
|
664
|
+
mastra api tool execute --help
|
|
665
|
+
mastra api memory current update --help
|
|
666
|
+
mastra api workflow run resume --help
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
Use `--schema` on commands that accept JSON input to inspect the request shape returned by the target server:
|
|
670
|
+
|
|
671
|
+
```bash
|
|
672
|
+
mastra api agent run --schema
|
|
673
|
+
mastra api thread create --schema
|
|
674
|
+
mastra api score create --schema
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
Some commands have important runtime requirements. For example, `mastra api memory current update` requires working memory to be enabled for the memory instance, and `mastra api workflow run resume` only works for suspended workflow runs.
|
|
678
|
+
|
|
679
|
+
### Commands
|
|
680
|
+
|
|
681
|
+
#### `mastra api agent list`
|
|
682
|
+
|
|
683
|
+
Lists the agents registered on the target server. Pass optional JSON input for route-supported filters.
|
|
684
|
+
|
|
685
|
+
```bash
|
|
686
|
+
mastra api agent list [input]
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
#### `mastra api agent get`
|
|
690
|
+
|
|
691
|
+
Gets metadata for one registered agent.
|
|
692
|
+
|
|
693
|
+
```bash
|
|
694
|
+
mastra api agent get <agentId>
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
#### `mastra api agent run`
|
|
698
|
+
|
|
699
|
+
Runs an agent with JSON input. Use command help to see examples for text prompts, chat messages, and memory thread options.
|
|
700
|
+
|
|
701
|
+
```bash
|
|
702
|
+
mastra api agent run <agentId> <input>
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
#### `mastra api workflow list`
|
|
706
|
+
|
|
707
|
+
Lists workflows registered on the target server. Pass optional JSON input for route-supported filters.
|
|
708
|
+
|
|
709
|
+
```bash
|
|
710
|
+
mastra api workflow list [input]
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
#### `mastra api workflow get`
|
|
714
|
+
|
|
715
|
+
Gets metadata for one registered workflow.
|
|
716
|
+
|
|
717
|
+
```bash
|
|
718
|
+
mastra api workflow get <workflowId>
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
#### `mastra api workflow run start`
|
|
722
|
+
|
|
723
|
+
Starts a workflow run with JSON input. Workflow start commands use a longer default timeout than most commands because runs can take longer to complete.
|
|
724
|
+
|
|
725
|
+
```bash
|
|
726
|
+
mastra api workflow run start <workflowId> <input>
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
#### `mastra api workflow run list`
|
|
730
|
+
|
|
731
|
+
Lists runs for a workflow. Pass optional JSON input for route-supported filters or pagination.
|
|
732
|
+
|
|
733
|
+
```bash
|
|
734
|
+
mastra api workflow run list <workflowId> [input]
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
#### `mastra api workflow run get`
|
|
738
|
+
|
|
739
|
+
Gets one workflow run by ID.
|
|
740
|
+
|
|
741
|
+
```bash
|
|
742
|
+
mastra api workflow run get <workflowId> <runId>
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
#### `mastra api workflow run resume`
|
|
746
|
+
|
|
747
|
+
Resumes a suspended workflow run with JSON input. The run must be in a suspended state.
|
|
748
|
+
|
|
749
|
+
```bash
|
|
750
|
+
mastra api workflow run resume <workflowId> <runId> <input>
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
#### `mastra api workflow run cancel`
|
|
754
|
+
|
|
755
|
+
Cancels a workflow run.
|
|
756
|
+
|
|
757
|
+
```bash
|
|
758
|
+
mastra api workflow run cancel <workflowId> <runId>
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
#### `mastra api tool list`
|
|
762
|
+
|
|
763
|
+
Lists tools registered on the target server. Pass optional JSON input for route-supported filters.
|
|
764
|
+
|
|
765
|
+
```bash
|
|
766
|
+
mastra api tool list [input]
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
#### `mastra api tool get`
|
|
770
|
+
|
|
771
|
+
Gets metadata and schemas for one tool.
|
|
772
|
+
|
|
773
|
+
```bash
|
|
774
|
+
mastra api tool get <toolId>
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
#### `mastra api tool execute`
|
|
778
|
+
|
|
779
|
+
Executes a tool with JSON input. Raw tool input is wrapped as the route `data` field unless you pass an explicit `data` object.
|
|
780
|
+
|
|
781
|
+
```bash
|
|
782
|
+
mastra api tool execute <toolId> <input>
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
#### `mastra api mcp list`
|
|
786
|
+
|
|
787
|
+
Lists Model Context Protocol (MCP) servers registered on the target server. Pass optional JSON input for route-supported filters.
|
|
788
|
+
|
|
789
|
+
```bash
|
|
790
|
+
mastra api mcp list [input]
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
#### `mastra api mcp get`
|
|
794
|
+
|
|
795
|
+
Gets metadata for one MCP server.
|
|
796
|
+
|
|
797
|
+
```bash
|
|
798
|
+
mastra api mcp get <id>
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
#### `mastra api mcp tool list`
|
|
802
|
+
|
|
803
|
+
Lists tools exposed by an MCP server. Pass optional JSON input for route-supported filters.
|
|
804
|
+
|
|
805
|
+
```bash
|
|
806
|
+
mastra api mcp tool list <serverId> [input]
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
#### `mastra api mcp tool get`
|
|
810
|
+
|
|
811
|
+
Gets metadata and schemas for one MCP tool.
|
|
812
|
+
|
|
813
|
+
```bash
|
|
814
|
+
mastra api mcp tool get <serverId> <toolId>
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
#### `mastra api mcp tool execute`
|
|
818
|
+
|
|
819
|
+
Executes an MCP tool with JSON input. Raw tool input is wrapped as the route `data` field unless you pass an explicit `data` object.
|
|
820
|
+
|
|
821
|
+
```bash
|
|
822
|
+
mastra api mcp tool execute <serverId> <toolId> <input>
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
#### `mastra api thread list`
|
|
826
|
+
|
|
827
|
+
Lists memory threads. Pass optional JSON input for route-supported filters.
|
|
828
|
+
|
|
829
|
+
```bash
|
|
830
|
+
mastra api thread list [input]
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
#### `mastra api thread get`
|
|
834
|
+
|
|
835
|
+
Gets one memory thread by ID.
|
|
836
|
+
|
|
837
|
+
```bash
|
|
838
|
+
mastra api thread get <threadId>
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
#### `mastra api thread create`
|
|
842
|
+
|
|
843
|
+
Creates a memory thread. Pass one JSON input object; the CLI splits fields such as `agentId` into query parameters when required by the server route.
|
|
844
|
+
|
|
845
|
+
```bash
|
|
846
|
+
mastra api thread create <input>
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
#### `mastra api thread update`
|
|
850
|
+
|
|
851
|
+
Updates a memory thread. Pass one JSON input object for fields such as `agentId`, `resourceId`, `title`, or `metadata`.
|
|
852
|
+
|
|
853
|
+
```bash
|
|
854
|
+
mastra api thread update <threadId> <input>
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
#### `mastra api thread delete`
|
|
858
|
+
|
|
859
|
+
Deletes a memory thread. Pass JSON input for route-required query parameters such as `agentId` and `resourceId`.
|
|
860
|
+
|
|
861
|
+
```bash
|
|
862
|
+
mastra api thread delete <threadId> <input>
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
#### `mastra api thread messages`
|
|
866
|
+
|
|
867
|
+
Lists messages for a memory thread. Pass optional JSON input for route-supported filters or pagination.
|
|
868
|
+
|
|
869
|
+
```bash
|
|
870
|
+
mastra api thread messages <threadId> [input]
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
#### `mastra api memory search`
|
|
874
|
+
|
|
875
|
+
Searches long-term memory. Use `--help` or `--schema` to inspect required fields such as `agentId`, `resourceId`, and `searchQuery`.
|
|
876
|
+
|
|
877
|
+
```bash
|
|
878
|
+
mastra api memory search <input>
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
#### `mastra api memory current get`
|
|
882
|
+
|
|
883
|
+
Reads current working memory for a thread.
|
|
884
|
+
|
|
885
|
+
```bash
|
|
886
|
+
mastra api memory current get <input>
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
#### `mastra api memory current update`
|
|
890
|
+
|
|
891
|
+
Updates current working memory for a thread. Working memory must be enabled for the memory instance.
|
|
892
|
+
|
|
893
|
+
```bash
|
|
894
|
+
mastra api memory current update <input>
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
#### `mastra api memory status`
|
|
898
|
+
|
|
899
|
+
Gets memory status for an agent and optional thread or resource context.
|
|
900
|
+
|
|
901
|
+
```bash
|
|
902
|
+
mastra api memory status <input>
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
#### `mastra api trace list`
|
|
906
|
+
|
|
907
|
+
Lists observability traces. Pass optional JSON input for route-supported filters or pagination.
|
|
908
|
+
|
|
909
|
+
```bash
|
|
910
|
+
mastra api trace list [input]
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
#### `mastra api trace get`
|
|
914
|
+
|
|
915
|
+
Gets one observability trace by ID.
|
|
916
|
+
|
|
917
|
+
```bash
|
|
918
|
+
mastra api trace get <traceId>
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
#### `mastra api log list`
|
|
922
|
+
|
|
923
|
+
Lists observability logs. Pass optional JSON input for route-supported filters or pagination.
|
|
924
|
+
|
|
925
|
+
```bash
|
|
926
|
+
mastra api log list [input]
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
#### `mastra api score create`
|
|
930
|
+
|
|
931
|
+
Creates an observability score. The input uses the server score body shape; inspect it with `--schema`.
|
|
932
|
+
|
|
933
|
+
```bash
|
|
934
|
+
mastra api score create <input>
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
#### `mastra api score list`
|
|
938
|
+
|
|
939
|
+
Lists observability scores. Pass optional JSON input for filters such as run ID or pagination.
|
|
940
|
+
|
|
941
|
+
```bash
|
|
942
|
+
mastra api score list [input]
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
#### `mastra api score get`
|
|
946
|
+
|
|
947
|
+
Gets one observability score by ID.
|
|
948
|
+
|
|
949
|
+
```bash
|
|
950
|
+
mastra api score get <scoreId>
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
#### `mastra api dataset list`
|
|
954
|
+
|
|
955
|
+
Lists datasets. Pass optional JSON input for route-supported filters or pagination.
|
|
956
|
+
|
|
957
|
+
```bash
|
|
958
|
+
mastra api dataset list [input]
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
#### `mastra api dataset get`
|
|
962
|
+
|
|
963
|
+
Gets one dataset by ID.
|
|
964
|
+
|
|
965
|
+
```bash
|
|
966
|
+
mastra api dataset get <datasetId>
|
|
967
|
+
```
|
|
968
|
+
|
|
969
|
+
#### `mastra api dataset create`
|
|
970
|
+
|
|
971
|
+
Creates a dataset with JSON input.
|
|
972
|
+
|
|
973
|
+
```bash
|
|
974
|
+
mastra api dataset create <input>
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
#### `mastra api dataset items`
|
|
978
|
+
|
|
979
|
+
Lists items in a dataset. Pass optional JSON input for route-supported filters or pagination.
|
|
980
|
+
|
|
981
|
+
```bash
|
|
982
|
+
mastra api dataset items <datasetId> [input]
|
|
983
|
+
```
|
|
984
|
+
|
|
985
|
+
#### `mastra api experiment list`
|
|
986
|
+
|
|
987
|
+
Lists experiments for a dataset. Pass optional JSON input for route-supported filters or pagination.
|
|
988
|
+
|
|
989
|
+
```bash
|
|
990
|
+
mastra api experiment list <datasetId> [input]
|
|
991
|
+
```
|
|
992
|
+
|
|
993
|
+
#### `mastra api experiment get`
|
|
994
|
+
|
|
995
|
+
Gets one experiment by ID.
|
|
996
|
+
|
|
997
|
+
```bash
|
|
998
|
+
mastra api experiment get <datasetId> <experimentId>
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
#### `mastra api experiment run`
|
|
1002
|
+
|
|
1003
|
+
Starts an experiment for a dataset with JSON input.
|
|
1004
|
+
|
|
1005
|
+
```bash
|
|
1006
|
+
mastra api experiment run <datasetId> <input>
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
#### `mastra api experiment results`
|
|
1010
|
+
|
|
1011
|
+
Lists results for an experiment. Pass optional JSON input for route-supported filters or pagination.
|
|
1012
|
+
|
|
1013
|
+
```bash
|
|
1014
|
+
mastra api experiment results <datasetId> <experimentId> [input]
|
|
1015
|
+
```
|
|
1016
|
+
|
|
553
1017
|
## Common flags
|
|
554
1018
|
|
|
555
1019
|
### `--dir`
|
|
@@ -161,7 +161,7 @@ const response = await agent.streamUntilIdle('Research solana for me', {
|
|
|
161
161
|
thread: 'thread-1',
|
|
162
162
|
resource: 'resource-1',
|
|
163
163
|
},
|
|
164
|
-
maxIdleMs: 5 * 60_000,
|
|
164
|
+
maxIdleMs: 5 * 60_000, //optional
|
|
165
165
|
})
|
|
166
166
|
|
|
167
167
|
response.processDataStream({
|
|
@@ -173,6 +173,31 @@ response.processDataStream({
|
|
|
173
173
|
})
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
+
### `resumeStreamUntilIdle()`
|
|
177
|
+
|
|
178
|
+
Resume a suspended agent stream with custom data and keep the stream open until every [background task](https://mastra.ai/docs/agents/background-tasks) dispatched during the run completes. Use this to continue execution after a suspension point, such as a workflow suspend within an agent. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `resumeStream()`:
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
const response = await agent.resumeStreamUntilIdle(
|
|
182
|
+
{ approved: true, selectedOption: 'plan-b' },
|
|
183
|
+
{
|
|
184
|
+
memory: {
|
|
185
|
+
thread: 'thread-1',
|
|
186
|
+
resource: 'resource-1',
|
|
187
|
+
},
|
|
188
|
+
runId: 'run-123',
|
|
189
|
+
toolCallId: 'tool-call-456', // optional
|
|
190
|
+
maxIdleMs: 5 * 60_000, //optional
|
|
191
|
+
},
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
await response.processDataStream({
|
|
195
|
+
onChunk: chunk => {
|
|
196
|
+
console.log(chunk)
|
|
197
|
+
},
|
|
198
|
+
})
|
|
199
|
+
```
|
|
200
|
+
|
|
176
201
|
The stream emits the same chunk types as `stream()`, plus `background-task-*` chunks for task lifecycle events. Visit [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) for the full server-side API and [background task chunks](https://mastra.ai/reference/streaming/ChunkType) for the payload shapes.
|
|
177
202
|
|
|
178
203
|
### `getTool()`
|
|
@@ -59,6 +59,8 @@ for await (const event of stream) {
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
Streaming responses can also include tool events. Tool-call streams use `response.output_item.added`, `response.function_call_arguments.delta`, `response.function_call_arguments.done`, and `response.output_item.done` events. Tool results appear as `function_call_output` items with `<toolCallId>:output` IDs.
|
|
63
|
+
|
|
62
64
|
**Returns:** `Promise<ResponsesStream>`.
|
|
63
65
|
|
|
64
66
|
#### `retrieve(responseId, requestContext?)`
|
|
@@ -130,6 +132,8 @@ Use [`client.conversations`](https://mastra.ai/reference/client-js/conversations
|
|
|
130
132
|
|
|
131
133
|
If the model calls a function, that activity appears in `response.output` as `function_call` and `function_call_output` items alongside the final assistant `message`.
|
|
132
134
|
|
|
135
|
+
When `stream: true`, function calls are also emitted as Responses stream events. Read `response.function_call_arguments.delta` events for partial argument chunks and prefer `response.function_call_arguments.done` for the finalized arguments payload and tool name. Read `response.output_item.done` events for completed `function_call` and `function_call_output` items. Tool output items use `<toolCallId>:output` IDs.
|
|
136
|
+
|
|
133
137
|
## Structured output
|
|
134
138
|
|
|
135
139
|
Use `text.format` when you want JSON output.
|