@mastra/mcp-docs-server 1.1.37-alpha.1 → 1.1.37-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/processors.md +10 -0
- package/.docs/docs/deployment/cloud-providers.md +1 -0
- package/.docs/docs/mastra-platform/observability.md +31 -1
- package/.docs/docs/memory/observational-memory.md +34 -0
- package/.docs/docs/voice/overview.md +76 -0
- package/.docs/guides/deployment/aws-bedrock-agentcore.md +432 -0
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/nearai.md +103 -0
- package/.docs/models/providers/opencode.md +2 -3
- package/.docs/models/providers/siliconflow.md +3 -1
- package/.docs/models/providers/xpersona.md +71 -0
- package/.docs/models/providers.md +2 -0
- package/.docs/reference/agents/agent.md +2 -0
- package/.docs/reference/agents/getMetadata.md +61 -0
- package/.docs/reference/cli/mastra.md +115 -3
- package/.docs/reference/index.md +2 -0
- package/.docs/reference/processors/processor-interface.md +148 -71
- package/.docs/reference/voice/xai-realtime.md +267 -0
- package/.docs/reference/workspace/docker-sandbox.md +60 -0
- package/CHANGELOG.md +21 -0
- package/dist/stdio.js +5 -5
- package/dist/stdio.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# NEAR AI Cloud
|
|
2
|
+
|
|
3
|
+
Access 33 NEAR AI Cloud models through Mastra's model router. Authentication is handled automatically using the `NEARAI_API_KEY` environment variable.
|
|
4
|
+
|
|
5
|
+
Learn more in the [NEAR AI Cloud documentation](https://docs.near.ai/).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
NEARAI_API_KEY=your-api-key
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Agent } from "@mastra/core/agent";
|
|
13
|
+
|
|
14
|
+
const agent = new Agent({
|
|
15
|
+
id: "my-agent",
|
|
16
|
+
name: "My Agent",
|
|
17
|
+
instructions: "You are a helpful assistant",
|
|
18
|
+
model: "nearai/Qwen/Qwen3-30B-A3B-Instruct-2507"
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Generate a response
|
|
22
|
+
const response = await agent.generate("Hello!");
|
|
23
|
+
|
|
24
|
+
// Stream a response
|
|
25
|
+
const stream = await agent.stream("Tell me a story");
|
|
26
|
+
for await (const chunk of stream) {
|
|
27
|
+
console.log(chunk);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [NEAR AI Cloud documentation](https://docs.near.ai/) for details.
|
|
32
|
+
|
|
33
|
+
## Models
|
|
34
|
+
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| ------------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `nearai/anthropic/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
38
|
+
| `nearai/anthropic/claude-opus-4-6` | 200K | | | | | | $5 | $25 |
|
|
39
|
+
| `nearai/anthropic/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
|
|
40
|
+
| `nearai/anthropic/claude-sonnet-4-5` | 200K | | | | | | $3 | $16 |
|
|
41
|
+
| `nearai/anthropic/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 |
|
|
42
|
+
| `nearai/black-forest-labs/FLUX.2-klein-4B` | 128K | | | | | | $1 | $1 |
|
|
43
|
+
| `nearai/google/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 |
|
|
44
|
+
| `nearai/google/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 |
|
|
45
|
+
| `nearai/google/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
|
|
46
|
+
| `nearai/google/gemini-3.1-flash-lite` | 1.0M | | | | | | $0.25 | $2 |
|
|
47
|
+
| `nearai/openai/gpt-4.1` | 1.0M | | | | | | $2 | $8 |
|
|
48
|
+
| `nearai/openai/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 |
|
|
49
|
+
| `nearai/openai/gpt-4.1-nano` | 1.0M | | | | | | $0.10 | $0.40 |
|
|
50
|
+
| `nearai/openai/gpt-5` | 400K | | | | | | $1 | $10 |
|
|
51
|
+
| `nearai/openai/gpt-5-mini` | 400K | | | | | | $0.25 | $2 |
|
|
52
|
+
| `nearai/openai/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
|
|
53
|
+
| `nearai/openai/gpt-5.1` | 400K | | | | | | $1 | $10 |
|
|
54
|
+
| `nearai/openai/gpt-5.2` | 400K | | | | | | $2 | $16 |
|
|
55
|
+
| `nearai/openai/gpt-5.4` | 1.1M | | | | | | $3 | $15 |
|
|
56
|
+
| `nearai/openai/gpt-5.4-mini` | 400K | | | | | | $0.75 | $5 |
|
|
57
|
+
| `nearai/openai/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
|
|
58
|
+
| `nearai/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
|
|
59
|
+
| `nearai/openai/gpt-oss-120b` | 131K | | | | | | $0.15 | $0.55 |
|
|
60
|
+
| `nearai/openai/o3` | 200K | | | | | | $2 | $8 |
|
|
61
|
+
| `nearai/openai/o3-mini` | 200K | | | | | | $1 | $4 |
|
|
62
|
+
| `nearai/openai/o4-mini` | 200K | | | | | | $1 | $4 |
|
|
63
|
+
| `nearai/openai/whisper-large-v3` | 448 | | | | | | $0.01 | — |
|
|
64
|
+
| `nearai/Qwen/Qwen3-30B-A3B-Instruct-2507` | 262K | | | | | | $0.15 | $0.55 |
|
|
65
|
+
| `nearai/Qwen/Qwen3-Embedding-0.6B` | 41K | | | | | | $0.01 | — |
|
|
66
|
+
| `nearai/Qwen/Qwen3-Reranker-0.6B` | 41K | | | | | | $0.01 | $0.01 |
|
|
67
|
+
| `nearai/Qwen/Qwen3-VL-30B-A3B-Instruct` | 256K | | | | | | $0.15 | $0.55 |
|
|
68
|
+
| `nearai/Qwen/Qwen3.5-122B-A10B` | 131K | | | | | | $0.40 | $3 |
|
|
69
|
+
| `nearai/zai-org/GLM-5.1-FP8` | 203K | | | | | | $0.85 | $3 |
|
|
70
|
+
|
|
71
|
+
## Advanced configuration
|
|
72
|
+
|
|
73
|
+
### Custom headers
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
const agent = new Agent({
|
|
77
|
+
id: "custom-agent",
|
|
78
|
+
name: "custom-agent",
|
|
79
|
+
model: {
|
|
80
|
+
url: "https://cloud-api.near.ai/v1",
|
|
81
|
+
id: "nearai/Qwen/Qwen3-30B-A3B-Instruct-2507",
|
|
82
|
+
apiKey: process.env.NEARAI_API_KEY,
|
|
83
|
+
headers: {
|
|
84
|
+
"X-Custom-Header": "value"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Dynamic model selection
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const agent = new Agent({
|
|
94
|
+
id: "dynamic-agent",
|
|
95
|
+
name: "Dynamic Agent",
|
|
96
|
+
model: ({ requestContext }) => {
|
|
97
|
+
const useAdvanced = requestContext.task === "complex";
|
|
98
|
+
return useAdvanced
|
|
99
|
+
? "nearai/zai-org/GLM-5.1-FP8"
|
|
100
|
+
: "nearai/Qwen/Qwen3-30B-A3B-Instruct-2507";
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenCode Zen
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 39 OpenCode Zen models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [OpenCode Zen documentation](https://opencode.ai/docs/zen).
|
|
6
6
|
|
|
@@ -73,7 +73,6 @@ for await (const chunk of stream) {
|
|
|
73
73
|
| `opencode/nemotron-3-super-free` | 205K | | | | | | — | — |
|
|
74
74
|
| `opencode/qwen3.5-plus` | 262K | | | | | | $0.20 | $1 |
|
|
75
75
|
| `opencode/qwen3.6-plus` | 262K | | | | | | $0.50 | $3 |
|
|
76
|
-
| `opencode/ring-2.6-1t-free` | 262K | | | | | | — | — |
|
|
77
76
|
|
|
78
77
|
## Advanced configuration
|
|
79
78
|
|
|
@@ -103,7 +102,7 @@ const agent = new Agent({
|
|
|
103
102
|
model: ({ requestContext }) => {
|
|
104
103
|
const useAdvanced = requestContext.task === "complex";
|
|
105
104
|
return useAdvanced
|
|
106
|
-
? "opencode/
|
|
105
|
+
? "opencode/qwen3.6-plus"
|
|
107
106
|
: "opencode/big-pickle";
|
|
108
107
|
}
|
|
109
108
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SiliconFlow
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 76 SiliconFlow models through Mastra's model router. Authentication is handled automatically using the `SILICONFLOW_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [SiliconFlow documentation](https://cloud.siliconflow.com/models).
|
|
6
6
|
|
|
@@ -44,6 +44,8 @@ for await (const chunk of stream) {
|
|
|
44
44
|
| `siliconflow/deepseek-ai/DeepSeek-V3.1-Terminus` | 164K | | | | | | $0.27 | $1 |
|
|
45
45
|
| `siliconflow/deepseek-ai/DeepSeek-V3.2` | 164K | | | | | | $0.27 | $0.42 |
|
|
46
46
|
| `siliconflow/deepseek-ai/DeepSeek-V3.2-Exp` | 164K | | | | | | $0.27 | $0.41 |
|
|
47
|
+
| `siliconflow/deepseek-ai/deepseek-v4-flash` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
48
|
+
| `siliconflow/deepseek-ai/deepseek-v4-pro` | 1.0M | | | | | | $2 | $3 |
|
|
47
49
|
| `siliconflow/deepseek-ai/deepseek-vl2` | 4K | | | | | | $0.15 | $0.15 |
|
|
48
50
|
| `siliconflow/inclusionAI/Ling-flash-2.0` | 131K | | | | | | $0.14 | $0.57 |
|
|
49
51
|
| `siliconflow/inclusionAI/Ling-mini-2.0` | 131K | | | | | | $0.07 | $0.28 |
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Xpersona
|
|
2
|
+
|
|
3
|
+
Access 1 Xpersona model through Mastra's model router. Authentication is handled automatically using the `XPERSONA_API_KEY` environment variable.
|
|
4
|
+
|
|
5
|
+
Learn more in the [Xpersona documentation](https://xpersona.co/docs).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
XPERSONA_API_KEY=your-api-key
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Agent } from "@mastra/core/agent";
|
|
13
|
+
|
|
14
|
+
const agent = new Agent({
|
|
15
|
+
id: "my-agent",
|
|
16
|
+
name: "My Agent",
|
|
17
|
+
instructions: "You are a helpful assistant",
|
|
18
|
+
model: "xpersona/xpersona-frieren-coder"
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Generate a response
|
|
22
|
+
const response = await agent.generate("Hello!");
|
|
23
|
+
|
|
24
|
+
// Stream a response
|
|
25
|
+
const stream = await agent.stream("Tell me a story");
|
|
26
|
+
for await (const chunk of stream) {
|
|
27
|
+
console.log(chunk);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Xpersona documentation](https://xpersona.co/docs) for details.
|
|
32
|
+
|
|
33
|
+
## Models
|
|
34
|
+
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| --------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `xpersona/xpersona-frieren-coder` | 128K | | | | | | $2 | $6 |
|
|
38
|
+
|
|
39
|
+
## Advanced configuration
|
|
40
|
+
|
|
41
|
+
### Custom headers
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
const agent = new Agent({
|
|
45
|
+
id: "custom-agent",
|
|
46
|
+
name: "custom-agent",
|
|
47
|
+
model: {
|
|
48
|
+
url: "https://xpersona.co/v1",
|
|
49
|
+
id: "xpersona/xpersona-frieren-coder",
|
|
50
|
+
apiKey: process.env.XPERSONA_API_KEY,
|
|
51
|
+
headers: {
|
|
52
|
+
"X-Custom-Header": "value"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Dynamic model selection
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
const agent = new Agent({
|
|
62
|
+
id: "dynamic-agent",
|
|
63
|
+
name: "Dynamic Agent",
|
|
64
|
+
model: ({ requestContext }) => {
|
|
65
|
+
const useAdvanced = requestContext.task === "complex";
|
|
66
|
+
return useAdvanced
|
|
67
|
+
? "xpersona/xpersona-frieren-coder"
|
|
68
|
+
: "xpersona/xpersona-frieren-coder";
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
```
|
|
@@ -67,6 +67,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
67
67
|
- [Moonshot AI (China)](https://mastra.ai/models/providers/moonshotai-cn)
|
|
68
68
|
- [Morph](https://mastra.ai/models/providers/morph)
|
|
69
69
|
- [NanoGPT](https://mastra.ai/models/providers/nano-gpt)
|
|
70
|
+
- [NEAR AI Cloud](https://mastra.ai/models/providers/nearai)
|
|
70
71
|
- [Nebius Token Factory](https://mastra.ai/models/providers/nebius)
|
|
71
72
|
- [Neuralwatt](https://mastra.ai/models/providers/neuralwatt)
|
|
72
73
|
- [Nova](https://mastra.ai/models/providers/nova)
|
|
@@ -105,6 +106,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
105
106
|
- [Xiaomi Token Plan (China)](https://mastra.ai/models/providers/xiaomi-token-plan-cn)
|
|
106
107
|
- [Xiaomi Token Plan (Europe)](https://mastra.ai/models/providers/xiaomi-token-plan-ams)
|
|
107
108
|
- [Xiaomi Token Plan (Singapore)](https://mastra.ai/models/providers/xiaomi-token-plan-sgp)
|
|
109
|
+
- [Xpersona](https://mastra.ai/models/providers/xpersona)
|
|
108
110
|
- [Z.AI](https://mastra.ai/models/providers/zai)
|
|
109
111
|
- [Z.AI Coding Plan](https://mastra.ai/models/providers/zai-coding-plan)
|
|
110
112
|
- [ZenMux](https://mastra.ai/models/providers/zenmux)
|
|
@@ -185,6 +185,8 @@ Returns an `AgentThreadSubscription` object with these members:
|
|
|
185
185
|
|
|
186
186
|
**description** (`string`): Optional description of the agent's purpose and capabilities.
|
|
187
187
|
|
|
188
|
+
**metadata** (`Record<string, unknown> | ({ requestContext: RequestContext }) => Record<string, unknown> | Promise<Record<string, unknown>>`): Optional metadata for classifying or filtering the agent in clients. Can be a static record or a function that resolves the metadata from the request context.
|
|
189
|
+
|
|
188
190
|
**instructions** (`SystemMessage | ({ requestContext: RequestContext }) => SystemMessage | Promise<SystemMessage>`): Instructions that guide the agent's behavior. Can be a string, array of strings, system message object, array of system messages, or a function that returns any of these types dynamically. SystemMessage types: string | string\[] | CoreSystemMessage | CoreSystemMessage\[] | SystemModelMessage | SystemModelMessage\[]
|
|
189
191
|
|
|
190
192
|
**model** (`MastraLanguageModel | ({ requestContext: RequestContext }) => MastraLanguageModel | Promise<MastraLanguageModel>`): The language model used by the agent. Can be provided statically or resolved at runtime.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Agent.getMetadata()
|
|
2
|
+
|
|
3
|
+
The `.getMetadata()` method retrieves the metadata configured for an agent, resolving it if it's a function. Use metadata to classify agents in clients without encoding that data in the agent ID or name.
|
|
4
|
+
|
|
5
|
+
## Usage example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
await agent.getMetadata()
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
**options** (`{ requestContext?: RequestContext }`): Optional configuration object containing request context. (Default: `{}`)
|
|
14
|
+
|
|
15
|
+
**options.requestContext** (`RequestContext`): Request Context passed to dynamic metadata functions. Ignored when metadata is static.
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
**metadata** (`Record<string, unknown> | Promise<Record<string, unknown>>`): The metadata configured for the agent, or \`undefined\` if no metadata was configured. Returns either directly or as a promise that resolves to the metadata when defined as a function.
|
|
20
|
+
|
|
21
|
+
## Extended usage example
|
|
22
|
+
|
|
23
|
+
Static metadata:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { Agent } from '@mastra/core/agent'
|
|
27
|
+
|
|
28
|
+
export const supportAgent = new Agent({
|
|
29
|
+
id: 'support-agent',
|
|
30
|
+
name: 'Support Agent',
|
|
31
|
+
instructions: 'You help customers with support requests.',
|
|
32
|
+
model: 'openai/gpt-5.4',
|
|
33
|
+
metadata: { type: 'support' },
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const metadata = supportAgent.getMetadata()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Dynamic metadata resolved from the request context:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { Agent } from '@mastra/core/agent'
|
|
43
|
+
|
|
44
|
+
export const supportAgent = new Agent({
|
|
45
|
+
id: 'support-agent',
|
|
46
|
+
name: 'Support Agent',
|
|
47
|
+
instructions: 'You help customers with support requests.',
|
|
48
|
+
model: 'openai/gpt-5.4',
|
|
49
|
+
metadata: ({ requestContext }) => ({
|
|
50
|
+
type: 'support',
|
|
51
|
+
tenant: requestContext.get('tenant'),
|
|
52
|
+
}),
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const metadata = await supportAgent.getMetadata({ requestContext })
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Related
|
|
59
|
+
|
|
60
|
+
- [Agents overview](https://mastra.ai/docs/agents/overview)
|
|
61
|
+
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
@@ -600,12 +600,13 @@ It accepts [common flags](#common-flags).
|
|
|
600
600
|
|
|
601
601
|
## `mastra api`
|
|
602
602
|
|
|
603
|
-
Calls a Mastra runtime server with JSON input and JSON output. Use it for local development servers, deployed Mastra platform projects,
|
|
603
|
+
Calls a Mastra runtime server with JSON input and JSON output. Use it for local development servers, deployed Mastra platform projects, self-hosted Mastra servers, or hosted Mastra Platform Observability APIs.
|
|
604
604
|
|
|
605
605
|
```bash
|
|
606
606
|
mastra api agent list --pretty
|
|
607
607
|
mastra api agent run weather-agent '{"messages":"What is the weather in London?"}'
|
|
608
608
|
mastra api tool execute get-weather '{"location":"San Francisco"}'
|
|
609
|
+
mastra api trace list '{"page":0,"perPage":20}' --pretty
|
|
609
610
|
```
|
|
610
611
|
|
|
611
612
|
Use `mastra api <resource> <action> --help` to see examples for a command.
|
|
@@ -638,7 +639,7 @@ Errors are written to `stderr` as JSON and return a non-zero exit code:
|
|
|
638
639
|
|
|
639
640
|
### Target resolution
|
|
640
641
|
|
|
641
|
-
|
|
642
|
+
For runtime commands, the command resolves the target server in this order:
|
|
642
643
|
|
|
643
644
|
1. `--url <url>` for an explicit remote or self-hosted server.
|
|
644
645
|
2. `http://localhost:4111` for a local `mastra dev` server.
|
|
@@ -646,6 +647,15 @@ The command resolves the target server in this order:
|
|
|
646
647
|
|
|
647
648
|
Automatic platform auth is only used when the CLI resolves a Mastra platform target from `.mastra-project.json`. Localhost targets and explicit `--url` targets don't receive automatic credentials. Headers passed with `--header` are sent to any target, including localhost.
|
|
648
649
|
|
|
650
|
+
For observability commands (`trace`, `log`, `score`, and `metric`), the CLI targets `https://observability.mastra.ai` by default instead of a project deployment URL. It resolves credentials in this order:
|
|
651
|
+
|
|
652
|
+
1. Explicit `Authorization` and `X-Mastra-Project-Id` headers passed with `--header`.
|
|
653
|
+
2. `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` from your environment.
|
|
654
|
+
3. Project metadata from `.mastra-project.json` for the project ID.
|
|
655
|
+
4. Your Mastra CLI login token as an auth fallback.
|
|
656
|
+
|
|
657
|
+
Use `--url` and `--header` when you need to override the default hosted observability target or credentials.
|
|
658
|
+
|
|
649
659
|
### Flags
|
|
650
660
|
|
|
651
661
|
#### `--url <url>`
|
|
@@ -701,6 +711,13 @@ List commands accept `page` and `perPage` in the JSON input when the target rout
|
|
|
701
711
|
|
|
702
712
|
```bash
|
|
703
713
|
mastra api score list '{"page":0,"perPage":50}'
|
|
714
|
+
mastra api trace list '{"page":0,"perPage":20}'
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
Routes that support filters accept them in the same JSON input. For example, observability trace listing supports pagination and route-supported filters:
|
|
718
|
+
|
|
719
|
+
```bash
|
|
720
|
+
mastra api trace list '{"page":0,"perPage":20,"filters":{"spanType":"agent"}}' --pretty
|
|
704
721
|
```
|
|
705
722
|
|
|
706
723
|
### Get command-specific help
|
|
@@ -956,14 +973,27 @@ Lists observability traces. Pass optional JSON input for route-supported filters
|
|
|
956
973
|
|
|
957
974
|
```bash
|
|
958
975
|
mastra api trace list [input]
|
|
976
|
+
mastra api trace list '{"page":0,"perPage":20}' --pretty
|
|
977
|
+
mastra api trace list '{"page":0,"perPage":20}' --verbose --pretty
|
|
959
978
|
```
|
|
960
979
|
|
|
980
|
+
`trace list` returns lightweight root span records by default so you can page through traces without fetching large input, output, attributes, or metadata payloads. Pass `--verbose` to fetch the full root span records.
|
|
981
|
+
|
|
961
982
|
#### `mastra api trace get`
|
|
962
983
|
|
|
963
|
-
Gets one observability trace
|
|
984
|
+
Gets a lightweight timeline for one observability trace without fetching full span input, output, attributes, or metadata payloads. Pass `--verbose` to fetch the full trace payload.
|
|
964
985
|
|
|
965
986
|
```bash
|
|
966
987
|
mastra api trace get <traceId>
|
|
988
|
+
mastra api trace get <traceId> --verbose
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
#### `mastra api trace span`
|
|
992
|
+
|
|
993
|
+
Gets one full span from an observability trace. Use this after `trace get` when you know which span you need to inspect.
|
|
994
|
+
|
|
995
|
+
```bash
|
|
996
|
+
mastra api trace span <traceId> <spanId>
|
|
967
997
|
```
|
|
968
998
|
|
|
969
999
|
#### `mastra api log list`
|
|
@@ -974,6 +1004,88 @@ Lists observability logs. Pass optional JSON input for route-supported filters o
|
|
|
974
1004
|
mastra api log list [input]
|
|
975
1005
|
```
|
|
976
1006
|
|
|
1007
|
+
#### `mastra api metric aggregate`
|
|
1008
|
+
|
|
1009
|
+
Gets a single aggregate metric value.
|
|
1010
|
+
|
|
1011
|
+
```bash
|
|
1012
|
+
mastra api metric aggregate '{"name":["latency_ms"],"aggregation":"avg"}'
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
#### `mastra api metric breakdown`
|
|
1016
|
+
|
|
1017
|
+
Gets metric values grouped by a label or field.
|
|
1018
|
+
|
|
1019
|
+
```bash
|
|
1020
|
+
mastra api metric breakdown '{"name":["latency_ms"],"aggregation":"avg","groupBy":["model"],"limit":10}'
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
#### `mastra api metric timeseries`
|
|
1024
|
+
|
|
1025
|
+
Gets metric values over time.
|
|
1026
|
+
|
|
1027
|
+
```bash
|
|
1028
|
+
mastra api metric timeseries '{"name":["latency_ms"],"aggregation":"avg","interval":"1h"}'
|
|
1029
|
+
```
|
|
1030
|
+
|
|
1031
|
+
#### `mastra api metric percentiles`
|
|
1032
|
+
|
|
1033
|
+
Gets metric percentile values over time. Percentile values use decimals from `0` to `1`.
|
|
1034
|
+
|
|
1035
|
+
```bash
|
|
1036
|
+
mastra api metric percentiles '{"name":"latency_ms","percentiles":[0.5,0.95,0.99],"interval":"1h"}'
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
#### `mastra api metric names`
|
|
1040
|
+
|
|
1041
|
+
Lists discovered metric names. Pass optional JSON input for prefix search and limit.
|
|
1042
|
+
|
|
1043
|
+
```bash
|
|
1044
|
+
mastra api metric names '{"prefix":"lat","limit":10}'
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
#### `mastra api metric label-keys`
|
|
1048
|
+
|
|
1049
|
+
Lists label keys for a metric.
|
|
1050
|
+
|
|
1051
|
+
```bash
|
|
1052
|
+
mastra api metric label-keys '{"metricName":"latency_ms"}'
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
#### `mastra api metric label-values`
|
|
1056
|
+
|
|
1057
|
+
Lists label values for a metric label key. Pass optional prefix and limit values to narrow the result.
|
|
1058
|
+
|
|
1059
|
+
```bash
|
|
1060
|
+
mastra api metric label-values '{"metricName":"latency_ms","labelKey":"model","prefix":"g","limit":10}'
|
|
1061
|
+
```
|
|
1062
|
+
|
|
1063
|
+
#### Observability with `curl`
|
|
1064
|
+
|
|
1065
|
+
You can call the hosted observability API directly with your platform access token and project ID:
|
|
1066
|
+
|
|
1067
|
+
```bash
|
|
1068
|
+
curl -sS "https://observability.mastra.ai/api/observability/traces?page=0&perPage=20" \
|
|
1069
|
+
-H "Authorization: Bearer $MASTRA_PLATFORM_ACCESS_TOKEN" \
|
|
1070
|
+
-H "X-Mastra-Project-Id: $MASTRA_PROJECT_ID" | jq
|
|
1071
|
+
```
|
|
1072
|
+
|
|
1073
|
+
Get a lightweight trace timeline:
|
|
1074
|
+
|
|
1075
|
+
```bash
|
|
1076
|
+
curl -sS "https://observability.mastra.ai/api/observability/traces/<trace-id>/light" \
|
|
1077
|
+
-H "Authorization: Bearer $MASTRA_PLATFORM_ACCESS_TOKEN" \
|
|
1078
|
+
-H "X-Mastra-Project-Id: $MASTRA_PROJECT_ID" | jq
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
Get a specific span:
|
|
1082
|
+
|
|
1083
|
+
```bash
|
|
1084
|
+
curl -sS "https://observability.mastra.ai/api/observability/traces/<trace-id>/spans/<span-id>" \
|
|
1085
|
+
-H "Authorization: Bearer $MASTRA_PLATFORM_ACCESS_TOKEN" \
|
|
1086
|
+
-H "X-Mastra-Project-Id: $MASTRA_PROJECT_ID" | jq
|
|
1087
|
+
```
|
|
1088
|
+
|
|
977
1089
|
#### `mastra api score create`
|
|
978
1090
|
|
|
979
1091
|
Creates an observability score. The input uses the server score body shape; inspect it with `--schema`.
|
package/.docs/reference/index.md
CHANGED
|
@@ -13,6 +13,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
13
13
|
- [.getInstructions()](https://mastra.ai/reference/agents/getInstructions)
|
|
14
14
|
- [.getLLM()](https://mastra.ai/reference/agents/getLLM)
|
|
15
15
|
- [.getMemory()](https://mastra.ai/reference/agents/getMemory)
|
|
16
|
+
- [.getMetadata()](https://mastra.ai/reference/agents/getMetadata)
|
|
16
17
|
- [.getModel()](https://mastra.ai/reference/agents/getModel)
|
|
17
18
|
- [.getTools()](https://mastra.ai/reference/agents/getTools)
|
|
18
19
|
- [.getVoice()](https://mastra.ai/reference/agents/getVoice)
|
|
@@ -267,6 +268,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
267
268
|
- [PlayAI](https://mastra.ai/reference/voice/playai)
|
|
268
269
|
- [Sarvam](https://mastra.ai/reference/voice/sarvam)
|
|
269
270
|
- [Speechify](https://mastra.ai/reference/voice/speechify)
|
|
271
|
+
- [xAI Realtime](https://mastra.ai/reference/voice/xai-realtime)
|
|
270
272
|
- [.addInstructions()](https://mastra.ai/reference/voice/voice.addInstructions)
|
|
271
273
|
- [.addTools()](https://mastra.ai/reference/voice/voice.addTools)
|
|
272
274
|
- [.answer()](https://mastra.ai/reference/voice/voice.answer)
|