@mastra/mcp-docs-server 0.13.10 → 0.13.11-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.
Files changed (59) hide show
  1. package/.docs/organized/changelogs/%40internal%2Fstorage-test-utils.md +9 -9
  2. package/.docs/organized/changelogs/%40internal%2Ftypes-builder.md +2 -0
  3. package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +18 -18
  4. package/.docs/organized/changelogs/%40mastra%2Fcore.md +23 -23
  5. package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +20 -20
  6. package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +20 -20
  7. package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +20 -20
  8. package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +20 -20
  9. package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +13 -13
  10. package/.docs/organized/changelogs/%40mastra%2Flibsql.md +9 -9
  11. package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +18 -18
  12. package/.docs/organized/changelogs/%40mastra%2Fmemory.md +12 -12
  13. package/.docs/organized/changelogs/%40mastra%2Fpg.md +9 -9
  14. package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +21 -21
  15. package/.docs/organized/changelogs/%40mastra%2Frag.md +12 -12
  16. package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +7 -0
  17. package/.docs/organized/changelogs/%40mastra%2Fserver.md +18 -18
  18. package/.docs/organized/changelogs/create-mastra.md +9 -9
  19. package/.docs/organized/changelogs/mastra.md +22 -22
  20. package/.docs/organized/code-examples/agent-network.md +4 -3
  21. package/.docs/organized/code-examples/agent.md +33 -2
  22. package/.docs/raw/agents/overview.mdx +21 -1
  23. package/.docs/raw/getting-started/mcp-docs-server.mdx +2 -2
  24. package/.docs/raw/rag/chunking-and-embedding.mdx +11 -0
  25. package/.docs/raw/reference/agents/agent.mdx +64 -38
  26. package/.docs/raw/reference/agents/generate.mdx +206 -202
  27. package/.docs/raw/reference/agents/getAgent.mdx +23 -38
  28. package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +62 -0
  29. package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +62 -0
  30. package/.docs/raw/reference/agents/getDefaultVNextStreamOptions.mdx +62 -0
  31. package/.docs/raw/reference/agents/getDescription.mdx +30 -0
  32. package/.docs/raw/reference/agents/getInstructions.mdx +36 -73
  33. package/.docs/raw/reference/agents/getLLM.mdx +69 -0
  34. package/.docs/raw/reference/agents/getMemory.mdx +42 -119
  35. package/.docs/raw/reference/agents/getModel.mdx +36 -75
  36. package/.docs/raw/reference/agents/getScorers.mdx +62 -0
  37. package/.docs/raw/reference/agents/getTools.mdx +36 -128
  38. package/.docs/raw/reference/agents/getVoice.mdx +36 -83
  39. package/.docs/raw/reference/agents/getWorkflows.mdx +37 -74
  40. package/.docs/raw/reference/agents/stream.mdx +263 -226
  41. package/.docs/raw/reference/agents/streamVNext.mdx +208 -402
  42. package/.docs/raw/reference/rag/chunk.mdx +51 -2
  43. package/.docs/raw/reference/scorers/answer-relevancy.mdx +6 -6
  44. package/.docs/raw/reference/scorers/bias.mdx +6 -6
  45. package/.docs/raw/reference/scorers/completeness.mdx +2 -2
  46. package/.docs/raw/reference/scorers/content-similarity.mdx +1 -1
  47. package/.docs/raw/reference/scorers/create-scorer.mdx +445 -0
  48. package/.docs/raw/reference/scorers/faithfulness.mdx +6 -6
  49. package/.docs/raw/reference/scorers/hallucination.mdx +6 -6
  50. package/.docs/raw/reference/scorers/keyword-coverage.mdx +2 -2
  51. package/.docs/raw/reference/scorers/mastra-scorer.mdx +116 -158
  52. package/.docs/raw/reference/scorers/toxicity.mdx +2 -2
  53. package/.docs/raw/scorers/custom-scorers.mdx +166 -268
  54. package/.docs/raw/scorers/overview.mdx +21 -13
  55. package/.docs/raw/server-db/local-dev-playground.mdx +3 -3
  56. package/package.json +3 -3
  57. package/.docs/raw/reference/agents/createTool.mdx +0 -241
  58. package/.docs/raw/reference/scorers/custom-code-scorer.mdx +0 -155
  59. package/.docs/raw/reference/scorers/llm-scorer.mdx +0 -210
@@ -1,45 +1,72 @@
1
1
  ---
2
- title: "Reference: Agent.generate() | Agents | Mastra Docs"
2
+ title: "Reference: generate() | Agents | Mastra Docs"
3
3
  description: "Documentation for the `.generate()` method in Mastra agents, which produces text or structured responses."
4
4
  ---
5
5
 
6
- # Agent.generate()
6
+ # generate()
7
7
 
8
- The `generate()` method is used to interact with an agent to produce text or structured responses. This method accepts `messages` and an optional `options` object as parameters.
8
+ The `.generate()` method is used to interact with an agent to produce text or structured responses. This method accepts messages and optional generation options.
9
9
 
10
- ## Parameters
11
-
12
- ### `messages`
10
+ ## Usage example
13
11
 
14
- The `messages` parameter can be:
12
+ ```typescript showLineNumbers copy
13
+ const response = await agent.generate("message for agent");
14
+ ```
15
15
 
16
- - A single string
17
- - An array of strings
18
- - An array of message objects with `role` and `content` properties
19
- - An array of `UIMessageWithMetadata` objects (for messages with metadata)
16
+ ## Parameters
20
17
 
21
- The message object structures:
18
+ <PropertiesTable
19
+ content={[
20
+ {
21
+ name: "messages",
22
+ type: "string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[]",
23
+ description: "The messages to send to the agent. Can be a single string, array of strings, or structured message objects with multimodal content (text, images, etc.).",
24
+ },
25
+ {
26
+ name: "options",
27
+ type: "AgentGenerateOptions",
28
+ isOptional: true,
29
+ description: "Optional configuration for the generation process.",
30
+ },
31
+ ]}
32
+ />
22
33
 
23
- ```typescript
24
- interface Message {
25
- role: "system" | "user" | "assistant";
26
- content: string;
27
- }
34
+ ## Extended usage example
28
35
 
29
- // For messages with metadata
30
- interface UIMessageWithMetadata {
31
- role: "user" | "assistant";
32
- content: string;
33
- parts: Array<{ type: string; text?: string; [key: string]: any }>;
34
- metadata?: Record<string, unknown>; // Optional metadata field
35
- }
36
+ ```typescript showLineNumbers copy
37
+ const response = await agent.generate([
38
+ { role: "user", content: "message for agent" },
39
+ {
40
+ role: "user",
41
+ content: [
42
+ {
43
+ type: "text",
44
+ text: "message for agent"
45
+ },
46
+ {
47
+ type: "image",
48
+ imageUrl: "https://example.com/image.jpg",
49
+ mimeType: "image/jpeg"
50
+ }
51
+ ]
52
+ }
53
+ ], {
54
+ temperature: 0.7,
55
+ maxSteps: 3,
56
+ memory: {
57
+ thread: "user-123",
58
+ resource: "test-app"
59
+ },
60
+ toolChoice: "auto",
61
+ providerOptions: {
62
+ openai: {
63
+ reasoningEffort: "high"
64
+ }
65
+ }
66
+ });
36
67
  ```
37
68
 
38
- When using `UIMessageWithMetadata`, the metadata will be preserved throughout the conversation and stored with the messages in memory.
39
-
40
- ### `options` (Optional)
41
-
42
- An optional object that can include configuration for output structure, memory management, tool usage, telemetry, and more.
69
+ ### Options parameters
43
70
 
44
71
  <PropertiesTable
45
72
  content={[
@@ -123,13 +150,6 @@ An optional object that can include configuration for output structure, memory m
123
150
  defaultValue: "2",
124
151
  description: "Maximum number of retries. Set to 0 to disable retries.",
125
152
  },
126
- {
127
- name: "memoryOptions",
128
- type: "MemoryConfig",
129
- isOptional: true,
130
- description:
131
- "**Deprecated.** Use `memory.options` instead. Configuration options for memory management. See MemoryConfig section below for details.",
132
- },
133
153
  {
134
154
  name: "onStepFinish",
135
155
  type: "GenerateTextOnStepFinishCallback<any> | never",
@@ -138,18 +158,51 @@ An optional object that can include configuration for output structure, memory m
138
158
  "Callback function called after each execution step. Receives step details as a JSON string. Unavailable for structured output",
139
159
  },
140
160
  {
141
- name: "resourceId",
161
+ name: "runId",
142
162
  type: "string",
143
163
  isOptional: true,
144
- description:
145
- "**Deprecated.** Use `memory.resource` instead. Identifier for the user or resource interacting with the agent. Must be provided if threadId is provided.",
164
+ description: "Unique ID for this generation run. Useful for tracking and debugging purposes.",
146
165
  },
147
166
  {
148
167
  name: "telemetry",
149
168
  type: "TelemetrySettings",
150
169
  isOptional: true,
151
170
  description:
152
- "Settings for telemetry collection during generation. See TelemetrySettings section below for details.",
171
+ "Settings for telemetry collection during generation.",
172
+ properties: [
173
+ {
174
+ parameters: [{
175
+ name: "isEnabled",
176
+ type: "boolean",
177
+ isOptional: true,
178
+ description: "Enable or disable telemetry. Disabled by default while experimental."
179
+ }]
180
+ },
181
+ {
182
+ parameters: [{
183
+ name: "recordInputs",
184
+ type: "boolean",
185
+ isOptional: true,
186
+ description: "Enable or disable input recording. Enabled by default. You might want to disable input recording to avoid recording sensitive information."
187
+ }]
188
+ },
189
+ {
190
+ parameters: [{
191
+ name: "recordOutputs",
192
+ type: "boolean",
193
+ isOptional: true,
194
+ description: "Enable or disable output recording. Enabled by default. You might want to disable output recording to avoid recording sensitive information."
195
+ }]
196
+ },
197
+ {
198
+ parameters: [{
199
+ name: "functionId",
200
+ type: "string",
201
+ isOptional: true,
202
+ description: "Identifier for this function. Used to group telemetry data by function."
203
+ }]
204
+ }
205
+ ]
153
206
  },
154
207
  {
155
208
  name: "temperature",
@@ -158,19 +211,42 @@ An optional object that can include configuration for output structure, memory m
158
211
  description:
159
212
  "Controls randomness in the model's output. Higher values (e.g., 0.8) make the output more random, lower values (e.g., 0.2) make it more focused and deterministic.",
160
213
  },
161
- {
162
- name: "threadId",
163
- type: "string",
164
- isOptional: true,
165
- description:
166
- "**Deprecated.** Use `memory.thread` instead. Identifier for the conversation thread. Allows for maintaining context across multiple interactions. Must be provided if resourceId is provided.",
167
- },
168
214
  {
169
215
  name: "toolChoice",
170
216
  type: "'auto' | 'none' | 'required' | { type: 'tool'; toolName: string }",
171
217
  isOptional: true,
172
218
  defaultValue: "'auto'",
173
219
  description: "Controls how the agent uses tools during generation.",
220
+ properties: [
221
+ {
222
+ parameters: [{
223
+ name: "'auto'",
224
+ type: "string",
225
+ description: "Let the model decide whether to use tools (default)."
226
+ }]
227
+ },
228
+ {
229
+ parameters: [{
230
+ name: "'none'",
231
+ type: "string",
232
+ description: "Do not use any tools."
233
+ }]
234
+ },
235
+ {
236
+ parameters: [{
237
+ name: "'required'",
238
+ type: "string",
239
+ description: "Require the model to use at least one tool."
240
+ }]
241
+ },
242
+ {
243
+ parameters: [{
244
+ name: "{ type: 'tool'; toolName: string }",
245
+ type: "object",
246
+ description: "Require the model to use a specific tool by name."
247
+ }]
248
+ }
249
+ ]
174
250
  },
175
251
  {
176
252
  name: "toolsets",
@@ -191,215 +267,143 @@ An optional object that can include configuration for output structure, memory m
191
267
  type: "boolean",
192
268
  isOptional: true,
193
269
  description: "Save messages incrementally after each stream step completes (default: false).",
194
- }
195
- ]}
196
- />
197
-
198
- #### MemoryConfig
199
-
200
- Configuration options for memory management:
201
-
202
- <PropertiesTable
203
- content={[
204
- {
205
- name: "lastMessages",
206
- type: "number | false",
207
- isOptional: true,
208
- description:
209
- "Number of most recent messages to include in context. Set to false to disable.",
210
270
  },
211
271
  {
212
- name: "semanticRecall",
213
- type: "boolean | object",
272
+ name: "providerOptions",
273
+ type: "Record<string, Record<string, JSONValue>>",
214
274
  isOptional: true,
215
- description:
216
- "Configuration for semantic memory recall. Can be boolean or detailed config.",
275
+ description: "Additional provider-specific options that are passed through to the underlying LLM provider. The structure is `{ providerName: { optionKey: value } }`. Since Mastra extends AI SDK, see the [AI SDK documentation](https://sdk.vercel.ai/docs/providers/ai-sdk-providers) for complete provider options.",
217
276
  properties: [
218
277
  {
219
- type: "number",
220
- parameters: [
221
- {
222
- name: "topK",
223
- type: "number",
224
- isOptional: true,
225
- description:
226
- "Number of most semantically similar messages to retrieve.",
227
- },
228
- ],
278
+ parameters: [{
279
+ name: "openai",
280
+ type: "Record<string, JSONValue>",
281
+ isOptional: true,
282
+ description: "OpenAI-specific options. Example: `{ reasoningEffort: 'high' }`"
283
+ }]
229
284
  },
230
285
  {
231
- type: "number | object",
232
- parameters: [
233
- {
234
- name: "messageRange",
235
- type: "number | { before: number; after: number }",
236
- isOptional: true,
237
- description:
238
- "Range of messages to consider for semantic search. Can be a single number or before/after configuration.",
239
- },
240
- ],
286
+ parameters: [{
287
+ name: "anthropic",
288
+ type: "Record<string, JSONValue>",
289
+ isOptional: true,
290
+ description: "Anthropic-specific options. Example: `{ maxTokens: 1000 }`"
291
+ }]
241
292
  },
242
- ],
243
- },
244
- {
245
- name: "workingMemory",
246
- type: "object",
247
- isOptional: true,
248
- description: "Configuration for working memory.",
249
- properties: [
250
293
  {
251
- type: "boolean",
252
- parameters: [
253
- {
254
- name: "enabled",
255
- type: "boolean",
256
- isOptional: true,
257
- description: "Whether to enable working memory.",
258
- },
259
- ],
294
+ parameters: [{
295
+ name: "google",
296
+ type: "Record<string, JSONValue>",
297
+ isOptional: true,
298
+ description: "Google-specific options. Example: `{ safetySettings: [...] }`"
299
+ }]
260
300
  },
261
301
  {
262
- type: "string",
263
- parameters: [
264
- {
265
- name: "template",
266
- type: "string",
267
- isOptional: true,
268
- description: "Template to use for working memory.",
269
- },
270
- ],
271
- },
272
- ],
302
+ parameters: [{
303
+ name: "[providerName]",
304
+ type: "Record<string, JSONValue>",
305
+ isOptional: true,
306
+ description: "Other provider-specific options. The key is the provider name and the value is a record of provider-specific options."
307
+ }]
308
+ }
309
+ ]
273
310
  },
274
311
  {
275
- name: "threads",
276
- type: "object",
312
+ name: "runtimeContext",
313
+ type: "RuntimeContext",
277
314
  isOptional: true,
278
- description: "Thread-specific memory configuration.",
279
- properties: [
280
- {
281
- type: "boolean | object",
282
- parameters: [
283
- {
284
- name: "generateTitle",
285
- type: "boolean | { model: LanguageModelV1 | ((ctx: RuntimeContext) => LanguageModelV1 | Promise<LanguageModelV1>), instructions: string | ((ctx: RuntimeContext) => string | Promise<string>) }",
286
- isOptional: true,
287
- description:
288
- `Controls automatic thread title generation from the user's first message. Can be a boolean to enable/disable using the agent's model, or an object specifying a custom model and/or custom instructions for title generation (useful for cost optimization or title customization).
289
- Example: { model: openai('gpt-4.1-nano'), instructions: 'Generate a concise title based on the initial user message.' }`,
290
- },
291
- ],
292
- },
293
- ],
315
+ description: "Runtime context for dependency injection and contextual information.",
294
316
  },
295
- ]}
296
- />
297
-
298
- #### TelemetrySettings
299
-
300
- Settings for telemetry collection during generation:
301
-
302
- <PropertiesTable
303
- content={[
304
317
  {
305
- name: "isEnabled",
306
- type: "boolean",
318
+ name: "maxTokens",
319
+ type: "number",
307
320
  isOptional: true,
308
- defaultValue: "false",
309
- description:
310
- "Enable or disable telemetry. Disabled by default while experimental.",
321
+ description: "Maximum number of tokens to generate.",
311
322
  },
312
323
  {
313
- name: "recordInputs",
314
- type: "boolean",
324
+ name: "topP",
325
+ type: "number",
315
326
  isOptional: true,
316
- defaultValue: "true",
317
- description:
318
- "Enable or disable input recording. You might want to disable this to avoid recording sensitive information, reduce data transfers, or increase performance.",
327
+ description: "Nucleus sampling. This is a number between 0 and 1. It is recommended to set either `temperature` or `topP`, but not both.",
319
328
  },
320
329
  {
321
- name: "recordOutputs",
322
- type: "boolean",
330
+ name: "topK",
331
+ type: "number",
323
332
  isOptional: true,
324
- defaultValue: "true",
325
- description:
326
- "Enable or disable output recording. You might want to disable this to avoid recording sensitive information, reduce data transfers, or increase performance.",
333
+ description: "Only sample from the top K options for each subsequent token. Used to remove 'long tail' low probability responses.",
327
334
  },
328
335
  {
329
- name: "functionId",
330
- type: "string",
336
+ name: "presencePenalty",
337
+ type: "number",
331
338
  isOptional: true,
332
- description:
333
- "Identifier for this function. Used to group telemetry data by function.",
339
+ description: "Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition).",
334
340
  },
335
341
  {
336
- name: "metadata",
337
- type: "Record<string, AttributeValue>",
342
+ name: "frequencyPenalty",
343
+ type: "number",
338
344
  isOptional: true,
339
- description:
340
- "Additional information to include in the telemetry data. AttributeValue can be string, number, boolean, array of these types, or null.",
345
+ description: "Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition).",
341
346
  },
342
347
  {
343
- name: "tracer",
344
- type: "Tracer",
348
+ name: "stopSequences",
349
+ type: "string[]",
345
350
  isOptional: true,
346
- description:
347
- "A custom OpenTelemetry tracer instance to use for the telemetry data. See OpenTelemetry documentation for details.",
351
+ description: "Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated.",
352
+ },
353
+ {
354
+ name: "seed",
355
+ type: "number",
356
+ isOptional: true,
357
+ description: "The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results.",
348
358
  },
359
+ {
360
+ name: "headers",
361
+ type: "Record<string, string | undefined>",
362
+ isOptional: true,
363
+ description: "Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.",
364
+ }
349
365
  ]}
350
366
  />
351
367
 
352
368
  ## Returns
353
369
 
354
- The return value of the `generate()` method depends on the options provided, specifically the `output` option.
355
-
356
- ### PropertiesTable for Return Values
357
-
358
370
  <PropertiesTable
359
371
  content={[
360
372
  {
361
373
  name: "text",
362
374
  type: "string",
363
375
  isOptional: true,
364
- description:
365
- "The generated text response. Present when output is 'text' (no schema provided).",
376
+ description: "The generated text response. Present when output is 'text' (no schema provided).",
366
377
  },
367
378
  {
368
379
  name: "object",
369
380
  type: "object",
370
381
  isOptional: true,
371
- description:
372
- "The generated structured response. Present when a schema is provided via `output` or `experimental_output`.",
382
+ description: "The generated structured response. Present when a schema is provided via `output` or `experimental_output`.",
373
383
  },
374
384
  {
375
385
  name: "toolCalls",
376
386
  type: "Array<ToolCall>",
377
387
  isOptional: true,
378
- description:
379
- "The tool calls made during the generation process. Present in both text and object modes.",
380
- },
381
- ]}
382
- />
383
-
384
- #### ToolCall Structure
385
-
386
- <PropertiesTable
387
- content={[
388
- {
389
- name: "toolName",
390
- type: "string",
391
- required: true,
392
- description: "The name of the tool invoked.",
393
- },
394
- {
395
- name: "args",
396
- type: "any",
397
- required: true,
398
- description: "The arguments passed to the tool.",
388
+ description: "The tool calls made during the generation process. Present in both text and object modes.",
389
+ properties: [
390
+ {
391
+ parameters: [{
392
+ name: "toolName",
393
+ type: "string",
394
+ required: true,
395
+ description: "The name of the tool invoked."
396
+ }]
397
+ },
398
+ {
399
+ parameters: [{
400
+ name: "args",
401
+ type: "any",
402
+ required: true,
403
+ description: "The arguments passed to the tool."
404
+ }]
405
+ }
406
+ ]
399
407
  },
400
408
  ]}
401
409
  />
402
-
403
- ## Related Methods
404
-
405
- For real-time streaming responses, see the [`stream()`](./stream.mdx) method documentation.
@@ -1,54 +1,39 @@
1
1
  ---
2
- title: "Reference: getAgent() | Agent Config | Agents | Mastra Docs"
3
- description: API Reference for getAgent.
2
+ title: "Reference: getAgent() | Agents | Mastra Docs"
3
+ description: "Documentation for the `.getAgent()` method in Mastra, which retrieves an agent by name."
4
4
  ---
5
5
 
6
- # `getAgent()`
7
-
8
- Retrieve an agent based on the provided configuration
9
-
10
- ```ts showLineNumbers copy
11
- async function getAgent({
12
- connectionId,
13
- agent,
14
- apis,
15
- logger,
16
- }: {
17
- connectionId: string;
18
- agent: Record<string, any>;
19
- apis: Record<string, IntegrationApi>;
20
- logger: any;
21
- }): Promise<(props: { prompt: string }) => Promise<any>> {
22
- return async (props: { prompt: string }) => {
23
- return { message: "Hello, world!" };
24
- };
25
- }
6
+ # getAgent()
7
+
8
+ The `.getAgent()` method is used to retrieve an agent. The method accepts a single `string` parameter for the agent's name.
9
+
10
+ ## Usage example
11
+
12
+ ```typescript showLineNumbers copy
13
+ const agent = mastra.getAgent("testAgent");
26
14
  ```
27
15
 
28
- ## API Signature
29
16
 
30
- ### Parameters
17
+ ## Parameters
31
18
 
32
19
  <PropertiesTable
33
20
  content={[
34
21
  {
35
- name: "connectionId",
36
- type: "string",
37
- description: "The connection ID to use for the agent's API calls.",
22
+ name: "name",
23
+ type: "TAgentName extends keyof TAgents",
24
+ description: "The name of the agent to retrieve. Must be a valid agent name that exists in the Mastra configuration.",
38
25
  },
26
+ ]}
27
+ />
28
+
29
+ ## Returns
30
+
31
+ <PropertiesTable
32
+ content={[
39
33
  {
40
34
  name: "agent",
41
- type: "Record<string, any>",
42
- description: "The agent configuration object.",
43
- },
44
- {
45
- name: "apis",
46
- type: "Record<string, IntegrationAPI>",
47
- description: "A map of API names to their respective API objects.",
35
+ type: "TAgents[TAgentName]",
36
+ description: "The agent instance with the specified name. Throws an error if the agent is not found.",
48
37
  },
49
38
  ]}
50
39
  />
51
-
52
- ### Returns
53
-
54
- <PropertiesTable content={[]} />
@@ -0,0 +1,62 @@
1
+ ---
2
+ title: "Reference: getDefaultGenerateOptions() | Agents | Mastra Docs"
3
+ description: "Documentation for the `.getDefaultGenerateOptions()` method in Mastra agents, which retrieves the default options used for generate calls."
4
+ ---
5
+
6
+ # getDefaultGenerateOptions()
7
+
8
+ The `.getDefaultGenerateOptions()` method retrieves the default generation options configured for an agent, resolving them if they're a function. These options are used as the base configuration for all `generate()` calls unless overridden.
9
+
10
+ ## Usage example
11
+
12
+ ```typescript showLineNumbers copy
13
+ const defaultOptions = await agent.getDefaultGenerateOptions();
14
+ ```
15
+
16
+ ## Parameters
17
+
18
+ <PropertiesTable
19
+ content={[
20
+ {
21
+ name: "options",
22
+ type: "{ runtimeContext?: RuntimeContext }",
23
+ isOptional: true,
24
+ defaultValue: "{}",
25
+ description: "Optional configuration object containing runtime context.",
26
+ },
27
+ ]}
28
+ />
29
+
30
+ ## Extended usage example
31
+
32
+ ```typescript showLineNumbers copy
33
+ const defaultOptions = await agent.getDefaultGenerateOptions({
34
+ runtimeContext: new RuntimeContext()
35
+ });
36
+ ```
37
+
38
+ ### Options parameters
39
+
40
+ <PropertiesTable
41
+ content={[
42
+ {
43
+ name: "runtimeContext",
44
+ type: "RuntimeContext",
45
+ isOptional: true,
46
+ defaultValue: "new RuntimeContext()",
47
+ description: "Runtime context for dependency injection and contextual information.",
48
+ },
49
+ ]}
50
+ />
51
+
52
+ ## Returns
53
+
54
+ <PropertiesTable
55
+ content={[
56
+ {
57
+ name: "defaultOptions",
58
+ type: "AgentGenerateOptions | Promise<AgentGenerateOptions>",
59
+ description: "The default generation options configured for the agent, either as a direct object or a promise that resolves to the options.",
60
+ },
61
+ ]}
62
+ />