@mastra/mcp-docs-server 0.13.22-alpha.1 → 0.13.22-alpha.3

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 (93) hide show
  1. package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +10 -0
  2. package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +9 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fastra.md +11 -11
  4. package/.docs/organized/changelogs/%40mastra%2Fchroma.md +13 -13
  5. package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +10 -10
  6. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +17 -17
  7. package/.docs/organized/changelogs/%40mastra%2Fcloud.md +12 -12
  8. package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
  9. package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +10 -10
  10. package/.docs/organized/changelogs/%40mastra%2Fcore.md +48 -48
  11. package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +10 -10
  12. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +31 -31
  13. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +28 -28
  14. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +22 -22
  15. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +23 -23
  16. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +60 -60
  17. package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +10 -10
  18. package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
  19. package/.docs/organized/changelogs/%40mastra%2Flance.md +11 -11
  20. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +11 -11
  21. package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
  22. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +18 -18
  23. package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +10 -10
  24. package/.docs/organized/changelogs/%40mastra%2Fmcp.md +10 -10
  25. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +10 -10
  26. package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +10 -10
  27. package/.docs/organized/changelogs/%40mastra%2Fmssql.md +10 -10
  28. package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
  29. package/.docs/organized/changelogs/%40mastra%2Fpg.md +21 -21
  30. package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +10 -10
  31. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +31 -31
  32. package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +11 -11
  33. package/.docs/organized/changelogs/%40mastra%2Frag.md +16 -16
  34. package/.docs/organized/changelogs/%40mastra%2Fs3vectors.md +11 -0
  35. package/.docs/organized/changelogs/%40mastra%2Fserver.md +19 -19
  36. package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +10 -10
  37. package/.docs/organized/changelogs/%40mastra%2Fupstash.md +11 -11
  38. package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +10 -10
  39. package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +10 -10
  40. package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +11 -11
  41. package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +10 -10
  42. package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +10 -10
  43. package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +9 -0
  44. package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +9 -0
  45. package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +10 -10
  46. package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +10 -10
  47. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +10 -10
  48. package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +10 -10
  49. package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +10 -10
  50. package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +10 -10
  51. package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +10 -10
  52. package/.docs/organized/changelogs/create-mastra.md +7 -7
  53. package/.docs/organized/changelogs/mastra.md +49 -49
  54. package/.docs/organized/code-examples/weather-agent.md +11 -4
  55. package/.docs/raw/agents/overview.mdx +1 -1
  56. package/.docs/raw/auth/firebase.mdx +285 -0
  57. package/.docs/raw/auth/index.mdx +3 -3
  58. package/.docs/raw/deployment/overview.mdx +7 -1
  59. package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +108 -0
  60. package/.docs/raw/getting-started/installation.mdx +0 -1
  61. package/.docs/raw/memory/overview.mdx +1 -1
  62. package/.docs/raw/reference/agents/ChunkType.mdx +8 -8
  63. package/.docs/raw/reference/auth/firebase.mdx +128 -0
  64. package/.docs/raw/reference/cli/dev.mdx +7 -1
  65. package/.docs/raw/reference/client-js/agents.mdx +3 -3
  66. package/.docs/raw/reference/client-js/memory.mdx +1 -1
  67. package/.docs/raw/reference/client-js/tools.mdx +1 -1
  68. package/.docs/raw/reference/core/getWorkflow.mdx +0 -1
  69. package/.docs/raw/reference/core/getWorkflows.mdx +0 -1
  70. package/.docs/raw/reference/core/setTelemetry.mdx +2 -2
  71. package/.docs/raw/reference/storage/postgresql.mdx +191 -0
  72. package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +2 -2
  73. package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
  74. package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +3 -3
  75. package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
  76. package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
  77. package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +1 -1
  78. package/.docs/raw/reference/workflows/workflow-methods/map.mdx +1 -1
  79. package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
  80. package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +1 -1
  81. package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +1 -1
  82. package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +1 -1
  83. package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
  84. package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +1 -1
  85. package/.docs/raw/server-db/local-dev-playground.mdx +31 -9
  86. package/.docs/raw/server-db/mastra-client.mdx +189 -73
  87. package/CHANGELOG.md +17 -0
  88. package/package.json +5 -5
  89. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +0 -302
  90. package/.docs/organized/changelogs/%40mastra%2Fgithub.md +0 -302
  91. package/.docs/organized/changelogs/%40mastra%2Fmem0.md +0 -302
  92. package/.docs/organized/changelogs/%40mastra%2Fragie.md +0 -302
  93. package/.docs/organized/code-examples/memory-with-mem0.md +0 -108
@@ -0,0 +1,108 @@
1
+ ---
2
+ title: 'Cedar-OS Integration'
3
+ description: 'Build AI-native frontends for your Mastra agents with Cedar-OS'
4
+ ---
5
+
6
+
7
+ import { Tabs, Steps } from "nextra/components";
8
+
9
+ # Integrate Cedar-OS with Mastra
10
+
11
+ Cedar-OS is an open-source agentic UI framework designed specifically for building the most ambitious AI-native applications. We built Cedar with Mastra in mind.
12
+
13
+ ## Should you use Cedar?
14
+
15
+ There are a few pillars we care about strongly that you can read more about [here](https://docs.cedarcopilot.com/introduction/philosophy):
16
+
17
+ #### 1. Developer experience
18
+ - **Every single component is downloaded shadcn-style** – You own all the code and can style it however you want
19
+ - **Works out of the box** – Just drop in our chat component, and it'll work
20
+ - **Fully extensible** - Built on a [Zustand store architecture](https://docs.cedarcopilot.com/introduction/architecture) that you can customize completely. Every single internal function can be overridden in one line.
21
+
22
+ #### 2. Enabling truly AI-native applications
23
+ For the first time in history, products can come to life. We want to help you build something with life.
24
+ - **[Spells](https://docs.cedarcopilot.com/spells/spells#what-are-spells)** - Users can trigger AI from keyboard shortcuts, mouse events, text selection, and other components
25
+ - **[State Diff Management](https://docs.cedarcopilot.com/state-diff/using-state-diff)** - Give users control over accepting/rejecting agent outputs
26
+ - **[Voice Integration](https://docs.cedarcopilot.com/voice/voice-integration)** - Let users control your app with their voice
27
+
28
+ ## Quick Start
29
+
30
+ <Steps>
31
+ ### Set up your project
32
+
33
+ Run Cedar's CLI command:
34
+ ``` bash
35
+ npx cedar-os-cli plant-seed
36
+ ```
37
+
38
+ If starting from scratch, select the **Mastra starter** template for a complete setup with both frontend and backend in a monorepo
39
+
40
+ If you already have a Mastra backend, use the **blank frontend cedar repo** option instead.
41
+ - This will give you the option to download components and download all dependencies for Cedar. We recommend at least downloading one of the chat components to get started.
42
+
43
+ ### Wrap your app with CedarCopilot
44
+
45
+ Wrap your application with the CedarCopilot provider to connect to your Mastra backend:
46
+
47
+ ```tsx
48
+ import { CedarCopilot } from 'cedar-os';
49
+
50
+ function App() {
51
+ return (
52
+ <CedarCopilot
53
+ llmProvider={{
54
+ provider: 'mastra',
55
+ baseURL: 'http://localhost:4111', // default dev port for Mastra
56
+ apiKey: process.env.NEXT_PUBLIC_MASTRA_API_KEY, // optional — only for backend auth
57
+ }}>
58
+ <YourApp />
59
+ </CedarCopilot>
60
+ );
61
+ }
62
+ ```
63
+
64
+ ### Configure Mastra endpoints
65
+
66
+ Configure your Mastra backend to work with Cedar by following the [Mastra Configuration Options](https://docs.cedarcopilot.com/agent-backend-connection/agent-backend-connection#mastra-configuration-options).
67
+
68
+ [Register API routes](https://mastra.ai/en/examples/deployment/custom-api-route) in your Mastra server (or NextJS serverless routes if in a monorepo):
69
+
70
+ ```ts mastra/src/index.ts
71
+ import { registerApiRoute } from '@mastra/core/server';
72
+
73
+ // POST /chat
74
+ // The chat's non-streaming default endpoint
75
+ registerApiRoute('/chat', {
76
+ method: 'POST',
77
+ // …validate input w/ zod
78
+ handler: async (c) => {
79
+ /* your agent.generate() logic */
80
+ },
81
+ });
82
+
83
+ // POST /chat/stream (SSE)
84
+ // The chat's streaming default endpoint
85
+ registerApiRoute('/chat/stream', {
86
+ method: 'POST',
87
+ handler: async (c) => {
88
+ /* stream agent output in SSE format */
89
+ },
90
+ });
91
+ ```
92
+
93
+ ### Add Cedar components
94
+
95
+ Drop Cedar components into your frontend – see [Chat Overview](https://docs.cedarcopilot.com/chat/chat-overview).
96
+
97
+ Your backend and frontend are now linked! You're ready to start building AI-native experiences with your Mastra agents.
98
+ </Steps>
99
+
100
+
101
+ ## More information
102
+
103
+ - Check out the [detailed Mastra integration guide](https://docs.cedarcopilot.com/agent-backend-connection/mastra#extending-mastra) for more configuration options (or for manual installation instructions if something goes wrong)
104
+ - Explore Mastra-specific optimizations and features we've built
105
+ - **Seamless event streaming** - Automatic rendering of [Mastra streamed events](https://docs.cedarcopilot.com/chat/custom-message-rendering#mastra-event-renderer)
106
+ - **Voice endpoint support** - Built-in [voice backend integration](https://docs.cedarcopilot.com/voice/agentic-backend#endpoint-configuration)
107
+ - **End-to-End type safety** - [Types](https://docs.cedarcopilot.com/type-safety/typing-agent-requests) for communicating between your app and Mastra backend
108
+ - [Join our Discord!](https://discord.gg/4AWawRjNdZ) We're excited to have you :)
@@ -12,7 +12,6 @@ To get started with Mastra, you’ll need access to a large language model (LLM)
12
12
 
13
13
  Mastra also supports other LLM providers. For a full list of supported models and setup instructions, see [Model Providers](/docs/getting-started/model-providers).
14
14
 
15
-
16
15
  ## Prerequisites
17
16
 
18
17
  - Node.js `v20.0` or higher
@@ -26,7 +26,7 @@ All memory types are [thread-scoped](./working-memory.mdx#thread-scoped-memory-d
26
26
 
27
27
  ### Working memory
28
28
 
29
- Stores persistent user-specific details such as names, preferences, goals, and other structured data. Uses [Markdown templates](./working-memory-template.mdx) or [Zod schemas](./working-memory-schema.mdx) to define structure.
29
+ Stores persistent user-specific details such as names, preferences, goals, and other structured data. Uses [Markdown templates](./working-memory.mdx) or [Zod schemas](./working-memory.mdx#structured-working-memory) to define structure.
30
30
 
31
31
  ### Conversation history
32
32
 
@@ -5,7 +5,7 @@ description: "Documentation for the ChunkType type used in Mastra streaming resp
5
5
 
6
6
  import { Callout } from "nextra/components";
7
7
  import { PropertiesTable } from "@/components/properties-table";
8
-
8
+
9
9
  # ChunkType
10
10
 
11
11
  <Callout type="warning">
@@ -826,24 +826,24 @@ for await (const chunk of stream.fullStream) {
826
826
  case 'text-delta':
827
827
  console.log('Text:', chunk.payload.text);
828
828
  break;
829
-
829
+
830
830
  case 'tool-call':
831
831
  console.log('Calling tool:', chunk.payload.toolName);
832
832
  break;
833
-
833
+
834
834
  case 'tool-result':
835
835
  console.log('Tool result:', chunk.payload.result);
836
836
  break;
837
-
837
+
838
838
  case 'reasoning-delta':
839
839
  console.log('Reasoning:', chunk.payload.text);
840
840
  break;
841
-
841
+
842
842
  case 'finish':
843
843
  console.log('Finished:', chunk.payload.stepResult.reason);
844
844
  console.log('Usage:', chunk.payload.output.usage);
845
845
  break;
846
-
846
+
847
847
  case 'error':
848
848
  console.error('Error:', chunk.payload.error);
849
849
  break;
@@ -853,5 +853,5 @@ for await (const chunk of stream.fullStream) {
853
853
 
854
854
  ## Related Types
855
855
 
856
- - [MastraModelOutput](/reference/agents/MastraModelOutput) - The stream object that emits these chunks
857
- - [Agent.streamVNext()](/reference/agents/streamVNext) - Method that returns streams emitting these chunks
856
+ - [MastraModelOutput](./MastraModelOutput.mdx) - The stream object that emits these chunks
857
+ - [Agent.streamVNext()](./streamVNext.mdx) - Method that returns streams emitting these chunks
@@ -0,0 +1,128 @@
1
+ ---
2
+ title: "MastraAuthFirebase Class"
3
+ description: "API reference for the MastraAuthFirebase class, which authenticates Mastra applications using Firebase Authentication."
4
+ ---
5
+
6
+ # MastraAuthFirebase Class
7
+
8
+ The `MastraAuthFirebase` class provides authentication for Mastra using Firebase Authentication. It verifies incoming requests using Firebase ID tokens and integrates with the Mastra server using the `experimental_auth` option.
9
+
10
+ ## Usage examples
11
+
12
+ ### Basic usage with environment variables
13
+
14
+ ```typescript filename="src/mastra/index.ts" showLineNumbers copy
15
+ import { Mastra } from "@mastra/core/mastra";
16
+ import { MastraAuthFirebase } from '@mastra/auth-firebase';
17
+
18
+ // Automatically uses FIREBASE_SERVICE_ACCOUNT and FIRESTORE_DATABASE_ID env vars
19
+ export const mastra = new Mastra({
20
+ // ..
21
+ server: {
22
+ experimental_auth: new MastraAuthFirebase(),
23
+ },
24
+ });
25
+ ```
26
+
27
+ ### Custom configuration
28
+
29
+ ```typescript filename="src/mastra/index.ts" showLineNumbers copy
30
+ import { Mastra } from "@mastra/core/mastra";
31
+ import { MastraAuthFirebase } from '@mastra/auth-firebase';
32
+
33
+ export const mastra = new Mastra({
34
+ // ..
35
+ server: {
36
+ experimental_auth: new MastraAuthFirebase({
37
+ serviceAccount: "/path/to/service-account-key.json",
38
+ databaseId: "your-database-id"
39
+ }),
40
+ },
41
+ });
42
+ ```
43
+
44
+ ## Constructor parameters
45
+
46
+ <PropertiesTable
47
+ content={[
48
+ {
49
+ name: "serviceAccount",
50
+ type: "string",
51
+ description: "Path to the Firebase service account JSON file. This file contains the credentials needed to verify Firebase ID tokens on the server side.",
52
+ isOptional: true,
53
+ defaultValue: "process.env.FIREBASE_SERVICE_ACCOUNT"
54
+ },
55
+ {
56
+ name: "databaseId",
57
+ type: "string",
58
+ description: "The Firestore database ID to use. Typically '(default)' for the default database.",
59
+ isOptional: true,
60
+ defaultValue: "process.env.FIRESTORE_DATABASE_ID || process.env.FIREBASE_DATABASE_ID"
61
+ },
62
+ {
63
+ name: "name",
64
+ type: "string",
65
+ description: "Custom name for the auth provider instance.",
66
+ isOptional: true,
67
+ defaultValue: '"firebase"'
68
+ },
69
+ {
70
+ name: "authorizeUser",
71
+ type: "(user: FirebaseUser) => Promise<boolean> | boolean",
72
+ description: "Custom authorization function to determine if a user should be granted access. Called after token verification. By default, checks for the presence of a document in the 'user_access' collection keyed by the user's UID.",
73
+ isOptional: true,
74
+ },
75
+ ]}
76
+ />
77
+
78
+ ## Environment Variables
79
+
80
+ The following environment variables are automatically used when constructor options are not provided:
81
+
82
+ <PropertiesTable
83
+ content={[
84
+ {
85
+ name: "FIREBASE_SERVICE_ACCOUNT",
86
+ type: "string",
87
+ description: "Path to Firebase service account JSON file. Used if serviceAccount option is not provided.",
88
+ isOptional: true,
89
+ },
90
+ {
91
+ name: "FIRESTORE_DATABASE_ID",
92
+ type: "string",
93
+ description: "Firestore database ID. Primary environment variable for database configuration.",
94
+ isOptional: true,
95
+ },
96
+ {
97
+ name: "FIREBASE_DATABASE_ID",
98
+ type: "string",
99
+ description: "Alternative environment variable for Firestore database ID. Used if FIRESTORE_DATABASE_ID is not set.",
100
+ isOptional: true,
101
+ },
102
+ ]}
103
+ />
104
+
105
+ ## Default Authorization Behavior
106
+
107
+ By default, `MastraAuthFirebase` uses Firestore to manage user access:
108
+
109
+ 1. After successfully verifying a Firebase ID token, the `authorizeUser` method is called
110
+ 2. It checks for the existence of a document in the `user_access` collection with the user's UID as the document ID
111
+ 3. If the document exists, the user is authorized; otherwise, access is denied
112
+ 4. The Firestore database used is determined by the `databaseId` parameter or environment variables
113
+
114
+ ## Firebase User Type
115
+
116
+ The `FirebaseUser` type used in the `authorizeUser` function corresponds to Firebase's `DecodedIdToken` interface, which includes:
117
+
118
+ - `uid`: The user's unique identifier
119
+ - `email`: The user's email address (if available)
120
+ - `email_verified`: Whether the email is verified
121
+ - `name`: The user's display name (if available)
122
+ - `picture`: URL to the user's profile picture (if available)
123
+ - `auth_time`: When the user authenticated
124
+ - And other standard JWT claims
125
+
126
+ ## Related
127
+
128
+ [MastraAuthFirebase Class](/docs/auth/firebase.mdx)
@@ -72,6 +72,12 @@ mastra dev [options]
72
72
  description: "display help for command",
73
73
  isOptional: true,
74
74
  },
75
+ {
76
+ name: "--https",
77
+ type: "boolean",
78
+ description: "Enable local HTTPS",
79
+ isOptional: true,
80
+ },
75
81
  ]}
76
82
  />
77
83
 
@@ -161,7 +167,7 @@ Workflows are expected to be exported from `src/mastra/workflows` (or the config
161
167
 
162
168
  ## Additional Notes
163
169
 
164
- The port defaults to 4111. Both the port and hostname can be configured via the mastra server config. See [Launch Development Server](/docs/server-db/local-dev-playground) for configuration details.
170
+ The port defaults to `4111`. The port, hostname, and HTTPS settings can also be configured via the Mastra server configuration. See [Launch Development Server](/docs/server-db/local-dev-playground) for configuration details.
165
171
 
166
172
  Make sure you have your environment variables set up in your `.env.development` or `.env` file for any providers you use (e.g., `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc.).
167
173
 
@@ -47,7 +47,7 @@ const response = await agent.generate({
47
47
  },
48
48
  ],
49
49
  threadId: "thread-1", // Optional: Thread ID for conversation context
50
- resourceid: "resource-1", // Optional: Resource ID
50
+ resourceId: "resource-1", // Optional: Resource ID
51
51
  output: {}, // Optional: Output configuration
52
52
  });
53
53
  ```
@@ -207,7 +207,7 @@ const response = await agent.generateVNext(
207
207
  "Hello, how are you?",
208
208
  {
209
209
  threadId: "thread-1",
210
- resourceid: "resource-1",
210
+ resourceId: "resource-1",
211
211
  }
212
212
  );
213
- ```
213
+ ```
@@ -57,7 +57,7 @@ Update thread properties:
57
57
  const updated = await thread.update({
58
58
  title: "Updated Title",
59
59
  metadata: { status: "resolved" },
60
- resourceid: "resource-1",
60
+ resourceId: "resource-1",
61
61
  });
62
62
  ```
63
63
 
@@ -44,6 +44,6 @@ const result = await tool.execute({
44
44
  param2: "value2",
45
45
  },
46
46
  threadId: "thread-1", // Optional: Thread context
47
- resourceid: "resource-1", // Optional: Resource identifier
47
+ resourceId: "resource-1", // Optional: Resource identifier
48
48
  });
49
49
  ```
@@ -46,4 +46,3 @@ mastra.getWorkflow("testWorkflow");
46
46
  ## Related
47
47
 
48
48
  - [Workflows overview](../../docs/workflows/overview.mdx)
49
- - [Dynamic workflows](../../docs/workflows/dynamic-workflows.mdx)
@@ -41,4 +41,3 @@ mastra.getWorkflows();
41
41
  ## Related
42
42
 
43
43
  - [Workflows overview](../../docs/workflows/overview.mdx)
44
- - [Dynamic workflows](../../docs/workflows/dynamic-workflows.mdx)
@@ -31,5 +31,5 @@ This method does not return a value.
31
31
 
32
32
  ## Related
33
33
 
34
- - [Telemetry overview](../../docs/observability/telemetry.mdx)
35
- - [Telemetry reference](../../reference/observability/telemetry.mdx)
34
+ - [Logging](../../docs/observability/logging.mdx)
35
+ - [PinoLogger](../../reference/observability/logger.mdx)
@@ -112,3 +112,194 @@ This enables direct queries and custom transaction management. When using these
112
112
 
113
113
  This approach is intended for advanced scenarios where low-level access is required.
114
114
 
115
+ ## Index Management
116
+
117
+ PostgreSQL storage provides comprehensive index management capabilities to optimize query performance.
118
+
119
+ ### Automatic Performance Indexes
120
+
121
+ PostgreSQL storage automatically creates composite indexes during initialization for common query patterns:
122
+
123
+ - `mastra_threads_resourceid_createdat_idx`: (resourceId, createdAt DESC)
124
+ - `mastra_messages_thread_id_createdat_idx`: (thread_id, createdAt DESC)
125
+ - `mastra_traces_name_starttime_idx`: (name, startTime DESC)
126
+ - `mastra_evals_agent_name_created_at_idx`: (agent_name, created_at DESC)
127
+
128
+ These indexes significantly improve performance for filtered queries with sorting.
129
+
130
+ ### Creating Custom Indexes
131
+
132
+ Create additional indexes to optimize specific query patterns:
133
+
134
+ ```typescript copy
135
+ // Basic index for common queries
136
+ await storage.createIndex({
137
+ name: 'idx_threads_resource',
138
+ table: 'mastra_threads',
139
+ columns: ['resourceId']
140
+ });
141
+
142
+ // Composite index with sort order for filtering + sorting
143
+ await storage.createIndex({
144
+ name: 'idx_messages_composite',
145
+ table: 'mastra_messages',
146
+ columns: ['thread_id', 'createdAt DESC']
147
+ });
148
+
149
+ // GIN index for JSONB columns (fast JSON queries)
150
+ await storage.createIndex({
151
+ name: 'idx_traces_attributes',
152
+ table: 'mastra_traces',
153
+ columns: ['attributes'],
154
+ method: 'gin'
155
+ });
156
+ ```
157
+
158
+ For more advanced use cases, you can also use:
159
+ - `unique: true` for unique constraints
160
+ - `where: 'condition'` for partial indexes
161
+ - `method: 'brin'` for time-series data
162
+ - `storage: { fillfactor: 90 }` for update-heavy tables
163
+ - `concurrent: true` for non-blocking creation (default)
164
+
165
+ ### Index Options
166
+
167
+ <PropertiesTable
168
+ content={[
169
+ {
170
+ name: "name",
171
+ type: "string",
172
+ description: "Unique name for the index",
173
+ isOptional: false,
174
+ },
175
+ {
176
+ name: "table",
177
+ type: "string",
178
+ description: "Table name (e.g., 'mastra_threads')",
179
+ isOptional: false,
180
+ },
181
+ {
182
+ name: "columns",
183
+ type: "string[]",
184
+ description: "Array of column names with optional sort order (e.g., ['id', 'createdAt DESC'])",
185
+ isOptional: false,
186
+ },
187
+ {
188
+ name: "unique",
189
+ type: "boolean",
190
+ description: "Creates a unique constraint index",
191
+ isOptional: true,
192
+ },
193
+ {
194
+ name: "concurrent",
195
+ type: "boolean",
196
+ description: "Creates index without locking table (default: true)",
197
+ isOptional: true,
198
+ },
199
+ {
200
+ name: "where",
201
+ type: "string",
202
+ description: "Partial index condition (PostgreSQL specific)",
203
+ isOptional: true,
204
+ },
205
+ {
206
+ name: "method",
207
+ type: "'btree' | 'hash' | 'gin' | 'gist' | 'spgist' | 'brin'",
208
+ description: "Index method (default: 'btree')",
209
+ isOptional: true,
210
+ },
211
+ {
212
+ name: "opclass",
213
+ type: "string",
214
+ description: "Operator class for GIN/GIST indexes",
215
+ isOptional: true,
216
+ },
217
+ {
218
+ name: "storage",
219
+ type: "Record<string, any>",
220
+ description: "Storage parameters (e.g., { fillfactor: 90 })",
221
+ isOptional: true,
222
+ },
223
+ {
224
+ name: "tablespace",
225
+ type: "string",
226
+ description: "Tablespace name for index placement",
227
+ isOptional: true,
228
+ }
229
+ ]}
230
+ />
231
+
232
+ ### Managing Indexes
233
+
234
+ List and monitor existing indexes:
235
+
236
+ ```typescript copy
237
+ // List all indexes
238
+ const allIndexes = await storage.listIndexes();
239
+ console.log(allIndexes);
240
+ // [
241
+ // {
242
+ // name: 'mastra_threads_pkey',
243
+ // table: 'mastra_threads',
244
+ // columns: ['id'],
245
+ // unique: true,
246
+ // size: '16 KB',
247
+ // definition: 'CREATE UNIQUE INDEX...'
248
+ // },
249
+ // ...
250
+ // ]
251
+
252
+ // List indexes for specific table
253
+ const threadIndexes = await storage.listIndexes('mastra_threads');
254
+
255
+ // Get detailed statistics for an index
256
+ const stats = await storage.describeIndex('idx_threads_resource');
257
+ console.log(stats);
258
+ // {
259
+ // name: 'idx_threads_resource',
260
+ // table: 'mastra_threads',
261
+ // columns: ['resourceId', 'createdAt'],
262
+ // unique: false,
263
+ // size: '128 KB',
264
+ // definition: 'CREATE INDEX idx_threads_resource...',
265
+ // method: 'btree',
266
+ // scans: 1542, // Number of index scans
267
+ // tuples_read: 45230, // Tuples read via index
268
+ // tuples_fetched: 12050 // Tuples fetched via index
269
+ // }
270
+
271
+ // Drop an index
272
+ await storage.dropIndex('idx_threads_status');
273
+ ```
274
+
275
+ ### Schema-Specific Indexes
276
+
277
+ When using custom schemas, indexes are created with schema prefixes:
278
+
279
+ ```typescript copy
280
+ const storage = new PostgresStore({
281
+ connectionString: process.env.DATABASE_URL,
282
+ schemaName: 'custom_schema'
283
+ });
284
+
285
+ // Creates index as: custom_schema_idx_threads_status
286
+ await storage.createIndex({
287
+ name: 'idx_threads_status',
288
+ table: 'mastra_threads',
289
+ columns: ['status']
290
+ });
291
+ ```
292
+
293
+ ### Index Types and Use Cases
294
+
295
+ PostgreSQL offers different index types optimized for specific scenarios:
296
+
297
+ | Index Type | Best For | Storage | Speed |
298
+ |------------|----------|---------|-------|
299
+ | **btree** (default) | Range queries, sorting, general purpose | Moderate | Fast |
300
+ | **hash** | Equality comparisons only | Small | Very fast for `=` |
301
+ | **gin** | JSONB, arrays, full-text search | Large | Fast for contains |
302
+ | **gist** | Geometric data, full-text search | Moderate | Fast for nearest-neighbor |
303
+ | **spgist** | Non-balanced data, text patterns | Small | Fast for specific patterns |
304
+ | **brin** | Large tables with natural ordering | Very small | Fast for ranges |
305
+
@@ -44,5 +44,5 @@ workflow.branch([
44
44
 
45
45
  ## Related
46
46
 
47
- - [Conditional branching](../../docs/workflows/control-flow.mdx)
48
- - [Conditional branching example](../../examples/workflows/conditional-branching.mdx)
47
+ - [Conditional Branching Logic](../../../docs/workflows/control-flow#conditional-logic-with-branch)
48
+ - [Conditional Branching Example](../../../examples/workflows/conditional-branching)
@@ -27,4 +27,4 @@ workflow.then(step1).commit();
27
27
 
28
28
  ## Related
29
29
 
30
- - [Control flow](../../docs/workflows/control-flow.mdx)
30
+ - [Control Flow](../../../docs/workflows/control-flow.mdx)
@@ -10,7 +10,7 @@ import { Callout } from "nextra/components";
10
10
  The `.createRunAsync()` method creates a new workflow run instance, allowing you to execute the workflow with specific input data. This is the current API that returns a `Run` instance.
11
11
 
12
12
  <Callout>
13
- For the legacy `createRun()` method that returns an object with methods, see the [Legacy Workflows](../legacyWorkflows/createRun.mdx) section.
13
+ For the legacy `createRun()` method that returns an object with methods, see the [Legacy Workflows](../../legacyWorkflows/createRun.mdx) section.
14
14
  </Callout>
15
15
 
16
16
  ## Usage example
@@ -61,5 +61,5 @@ const result = await run.start({
61
61
 
62
62
  ## Related
63
63
 
64
- - [Run Class](./run.mdx)
65
- - [Running workflows](../../examples/workflows/running-workflows.mdx)
64
+ - [Run Class](../run.mdx)
65
+ - [Running workflows](../../../examples/workflows/running-workflows.mdx)
@@ -47,4 +47,4 @@ workflow.dountil(step1, async ({ inputData }) => true);
47
47
 
48
48
  ## Related
49
49
 
50
- - [Control flow](../../docs/workflows/control-flow.mdx)
50
+ - [Control Flow](../../../docs/workflows/control-flow.mdx)
@@ -47,4 +47,4 @@ workflow.dowhile(step1, async ({ inputData }) => true);
47
47
 
48
48
  ## Related
49
49
 
50
- - [Control flow](../../docs/workflows/control-flow.mdx)
50
+ - [Control Flow](../../../docs/workflows/control-flow.mdx)
@@ -57,4 +57,4 @@ workflow.foreach(step1, { concurrency: 2 });
57
57
 
58
58
  ## Related
59
59
 
60
- - [For each](../../docs/workflows/control-flow.mdx)
60
+ - [Repeating with foreach](../../../docs/workflows/control-flow.mdx#repeating-with-foreach)
@@ -40,4 +40,4 @@ workflow.map(async ({ inputData }) => `${inputData.value} - map`
40
40
 
41
41
  ## Related
42
42
 
43
- - [Input data mapping](../../docs/workflows/input-data-mapping.mdx)
43
+ - [Input data mapping](../../../docs/workflows/input-data-mapping.mdx)
@@ -40,4 +40,4 @@ workflow.parallel([step1, step2]);
40
40
 
41
41
  ## Related
42
42
 
43
- - [Parallel workflow example](../../examples/workflows/parallel-steps.mdx)
43
+ - [Parallel Workflow Example](../../../examples/workflows/parallel-steps.mdx)
@@ -46,4 +46,4 @@ workflow.sendEvent('event-name', step1);
46
46
 
47
47
  ## Related
48
48
 
49
- - [Sleep & Events](../../docs/workflows/pausing-execution.mdx)
49
+ - [Sleep & Events](../../../docs/workflows/pausing-execution.mdx)
@@ -40,4 +40,4 @@ workflow.sleep(5000);
40
40
 
41
41
  ## Related
42
42
 
43
- - [Sleep & Events](../../docs/workflows/pausing-execution.mdx)
43
+ - [Sleep & Events](../../../docs/workflows/pausing-execution.mdx)