@mastra/mcp-docs-server 1.3.12 → 1.3.13-alpha.10
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/resumable-streams.md +140 -0
- package/.docs/docs/agents/tools.md +3 -2
- package/.docs/docs/auth/overview.md +1 -0
- package/.docs/docs/auth/simple-auth.md +8 -8
- package/.docs/docs/channels.md +34 -1
- package/.docs/docs/connections/mcp.md +73 -7
- package/.docs/docs/deployment/mastra-server.md +10 -2
- package/.docs/docs/deployment/workers.md +3 -1
- package/.docs/docs/guides/authentication-identity.md +4 -0
- package/.docs/docs/harness/background-tasks.md +2 -1
- package/.docs/docs/harness/durable-agents.md +106 -8
- package/.docs/docs/harness/goals.md +1 -1
- package/.docs/docs/harness/schedules.md +2 -0
- package/.docs/docs/knowledge/agents-and-tools.md +122 -0
- package/.docs/docs/knowledge/load-your-content.md +86 -0
- package/.docs/docs/knowledge/overview.md +106 -0
- package/.docs/docs/knowledge/patterns.md +167 -0
- package/.docs/docs/knowledge/pinned-context.md +177 -0
- package/.docs/docs/knowledge/scopes-and-access.md +202 -0
- package/.docs/docs/knowledge/search.md +63 -0
- package/.docs/docs/mastra-platform/connect.md +231 -0
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/memory/observational-memory.md +23 -23
- package/.docs/docs/memory/overview.md +19 -7
- package/.docs/docs/memory/semantic-recall.md +26 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +41 -0
- package/.docs/docs/observability/tracing/overview.md +0 -2
- package/.docs/docs/sandbox/skills.md +32 -3
- package/.docs/docs/server/custom-adapters.md +44 -11
- package/.docs/docs/server/middleware.md +1 -1
- package/.docs/docs/server/request-context.md +6 -6
- package/.docs/docs/server/server-adapters.md +12 -12
- package/.docs/docs/signals/sending-signals.md +3 -1
- package/.docs/docs/studio/knowledge.md +45 -24
- package/.docs/docs/studio/overview.md +3 -1
- package/.docs/docs/workflows/overview.md +12 -0
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/integrations/agentic-ui/ai-sdk-ui.md +46 -0
- package/.docs/integrations/auth/clerk.md +46 -7
- package/.docs/integrations/auth/neon.md +217 -0
- package/.docs/integrations/auth/supabase.md +46 -7
- package/.docs/integrations/auth/workos.md +54 -15
- package/.docs/integrations/channels/discord.md +84 -6
- package/.docs/integrations/channels/github.md +63 -24
- package/.docs/integrations/channels/slack.md +89 -8
- package/.docs/integrations/channels/teams.md +79 -5
- package/.docs/integrations/channels/telegram.md +47 -6
- package/.docs/integrations/crm/attio.md +42 -0
- package/.docs/integrations/crm/clay.md +42 -0
- package/.docs/integrations/crm/hubspot.md +41 -0
- package/.docs/integrations/databases/neon.md +37 -1
- package/.docs/integrations/databases/postgresql.md +46 -0
- package/.docs/integrations/deploy/render.md +59 -18
- package/.docs/integrations/deploy/temporal.md +74 -0
- package/.docs/integrations/documents/google-docs.md +41 -0
- package/.docs/integrations/documents/google-sheet.md +41 -0
- package/.docs/integrations/documents/microsoft-excel.md +43 -0
- package/.docs/integrations/documents/microsoft-powerpoint.md +41 -0
- package/.docs/integrations/documents/microsoft-word.md +41 -0
- package/.docs/integrations/documents/notion.md +41 -0
- package/.docs/integrations/documents/one-drive.md +41 -0
- package/.docs/integrations/documents/sharepoint-online.md +41 -0
- package/.docs/integrations/email-calendar/google-calendar.md +41 -0
- package/.docs/integrations/email-calendar/google-mail.md +41 -0
- package/.docs/integrations/email-calendar/outlook.md +41 -0
- package/.docs/integrations/file-storage/amazon-s3.md +1 -1
- package/.docs/integrations/file-storage/google-drive.md +54 -15
- package/.docs/integrations/observability/arize.md +1 -1
- package/.docs/integrations/observability/posthog.md +50 -11
- package/.docs/integrations/other/canva.md +42 -0
- package/.docs/integrations/other/fireflies.md +41 -0
- package/.docs/integrations/other/incident-io.md +41 -0
- package/.docs/integrations/other/resend.md +43 -0
- package/.docs/integrations/other/robinhood.md +44 -0
- package/.docs/integrations/other/sanity.md +42 -0
- package/.docs/integrations/other/snowflake.md +41 -0
- package/.docs/integrations/project-management/jira.md +41 -0
- package/.docs/integrations/project-management/linear.md +41 -0
- package/.docs/integrations/sandboxes/e2b.md +1 -1
- package/.docs/integrations/voice/openai.md +40 -0
- package/.docs/integrations.md +40 -1
- package/.docs/models/environment-variables.md +1 -1
- package/.docs/models/gateways/azure-openai.md +61 -2
- package/.docs/models/gateways/custom-gateways.md +2 -0
- package/.docs/models/gateways/merge-gateway.md +3 -1
- package/.docs/models/gateways/netlify.md +13 -7
- package/.docs/models/gateways/openrouter.md +13 -12
- package/.docs/models/gateways/requesty.md +221 -0
- package/.docs/models/gateways/vercel.md +423 -419
- package/.docs/models/gateways.md +7 -1
- package/.docs/models/index.md +46 -3
- package/.docs/models/providers/aiand.md +1 -1
- package/.docs/models/providers/aihubmix.md +2 -0
- package/.docs/models/providers/amazon-bedrock.md +4 -0
- package/.docs/models/providers/anthropic.md +2 -1
- package/.docs/models/providers/azure.md +4 -0
- package/.docs/models/providers/baseten.md +2 -1
- package/.docs/models/providers/chutes.md +6 -4
- package/.docs/models/providers/cloudflare-ai-gateway.md +2 -0
- package/.docs/models/providers/cloudflare-workers-ai.md +0 -13
- package/.docs/models/providers/cohere.md +2 -0
- package/.docs/models/providers/crossmodel.md +5 -1
- package/.docs/models/providers/deepinfra.md +2 -1
- package/.docs/models/providers/edenai.md +12 -13
- package/.docs/models/providers/empiriolabs.md +3 -3
- package/.docs/models/providers/fireworks-ai.md +30 -28
- package/.docs/models/providers/google-vertex.md +2 -0
- package/.docs/models/providers/google.md +4 -3
- package/.docs/models/providers/hyper.md +8 -14
- package/.docs/models/providers/inceptron.md +3 -3
- package/.docs/models/providers/kilo.md +36 -40
- package/.docs/models/providers/llmgateway-providers.md +448 -423
- package/.docs/models/providers/llmgateway.md +10 -6
- package/.docs/models/providers/meta.md +5 -4
- package/.docs/models/providers/modular.md +6 -6
- package/.docs/models/providers/morph.md +2 -1
- package/.docs/models/providers/nano-gpt.md +55 -62
- package/.docs/models/providers/novita-ai.md +4 -2
- package/.docs/models/providers/ollama-cloud.md +2 -1
- package/.docs/models/providers/ollama.md +2 -0
- package/.docs/models/providers/opencode-go.md +3 -1
- package/.docs/models/providers/opencode.md +11 -5
- package/.docs/models/providers/ovhcloud.md +1 -2
- package/.docs/models/providers/prime.md +4 -4
- package/.docs/models/providers/qvac.md +2 -0
- package/.docs/models/providers/tencent-token-plan.md +2 -1
- package/.docs/models/providers/tencent-tokenhub.md +2 -1
- package/.docs/models/providers/tinfoil.md +4 -3
- package/.docs/models/providers/togetherai.md +2 -1
- package/.docs/models/providers/wandb.md +6 -5
- package/.docs/models/providers.md +0 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +4 -2
- package/.docs/reference/agent-controller/session.md +1 -1
- package/.docs/reference/agents/agent.md +3 -1
- package/.docs/reference/agents/channels.md +117 -1
- package/.docs/reference/agents/durable-agent.md +42 -29
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/agents/getLLM.md +1 -1
- package/.docs/reference/agents/getMetadata.md +1 -1
- package/.docs/reference/agents/getModel.md +4 -2
- package/.docs/reference/agents/getSkill.md +1 -1
- package/.docs/reference/agents/listScorers.md +1 -1
- package/.docs/reference/agents/listTools.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +33 -2
- package/.docs/reference/auth/better-auth.md +2 -2
- package/.docs/reference/auth/neon.md +24 -15
- package/.docs/reference/build-with-ai.md +12 -2
- package/.docs/reference/channels/slack-provider.md +1 -1
- package/.docs/reference/cli/mastra.md +10 -1
- package/.docs/reference/client-js/agents.md +4 -4
- package/.docs/reference/client-js/observability.md +90 -3
- package/.docs/reference/code-sdk/mount-agent-controller.md +5 -1
- package/.docs/reference/connect/channels.md +55 -1
- package/.docs/reference/connect/credential.md +2 -1
- package/.docs/reference/connect/providers.md +5 -3
- package/.docs/reference/connect/tools.md +34 -3
- package/.docs/reference/core/addDynamicWorkflow.md +1 -1
- package/.docs/reference/core/addGateway.md +1 -1
- package/.docs/reference/core/getAgent.md +4 -2
- package/.docs/reference/core/getEditor.md +1 -1
- package/.docs/reference/core/getGateway.md +1 -1
- package/.docs/reference/core/getGatewayById.md +14 -1
- package/.docs/reference/core/getMemory.md +2 -2
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/listMemory.md +3 -3
- package/.docs/reference/core/listScorers.md +2 -2
- package/.docs/reference/core/listVectors.md +1 -1
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/evals/completeness.md +0 -1
- package/.docs/reference/evals/content-similarity.md +1 -3
- package/.docs/reference/evals/create-scorer.md +8 -4
- package/.docs/reference/evals/faithfulness.md +1 -1
- package/.docs/reference/evals/hallucination.md +2 -2
- package/.docs/reference/evals/noise-sensitivity.md +8 -1
- package/.docs/reference/evals/scorer-utils.md +1 -1
- package/.docs/reference/file-based-agents/tools.md +3 -3
- package/.docs/reference/index.md +8 -0
- package/.docs/reference/knowledge/knowledge-class.md +296 -0
- package/.docs/reference/knowledge/knowledge-memory-scopes.md +78 -0
- package/.docs/reference/knowledge/knowledge-tools.md +299 -0
- package/.docs/reference/knowledge/limits.md +44 -0
- package/.docs/reference/knowledge/scope-declarations.md +275 -0
- package/.docs/reference/knowledge/tool-instructions.md +56 -0
- package/.docs/reference/logging/pino-logger.md +1 -1
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/memory/observational-memory.md +9 -7
- package/.docs/reference/observability/feedback.md +3 -1
- package/.docs/reference/observability/tracing/advanced-queries.md +47 -58
- package/.docs/reference/observability/tracing/configuration.md +3 -0
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +33 -0
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +30 -0
- package/.docs/reference/observability/tracing/interfaces.md +2 -0
- package/.docs/reference/processors/batch-parts-processor.md +0 -2
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/moderation-processor.md +1 -1
- package/.docs/reference/processors/processor-interface.md +1 -1
- package/.docs/reference/processors/semantic-recall-processor.md +8 -4
- package/.docs/reference/processors/skill-search-processor.md +3 -0
- package/.docs/reference/processors/skills-processor.md +84 -0
- package/.docs/reference/processors/stream-error-retry-processor.md +1 -1
- package/.docs/reference/processors/token-limiter-processor.md +1 -1
- package/.docs/reference/processors/tool-search-processor.md +1 -1
- package/.docs/reference/pubsub/lease-provider.md +4 -2
- package/.docs/reference/pubsub/redis-streams.md +3 -1
- package/.docs/reference/rag/graph-rag.md +2 -2
- package/.docs/reference/rag/rerank.md +1 -1
- package/.docs/reference/rag/rerankWithScorer.md +1 -1
- package/.docs/reference/schedules/overview.md +3 -3
- package/.docs/reference/server/invoke-route.md +86 -0
- package/.docs/reference/server/koa-adapter.md +1 -1
- package/.docs/reference/server/routes.md +63 -0
- package/.docs/reference/streaming/ChunkType.md +3 -1
- package/.docs/reference/streaming/agents/MastraModelOutput.md +13 -12
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/tools/mcp-client.md +30 -7
- package/.docs/reference/tools/mcp-server.md +6 -2
- package/.docs/reference/tools/vector-query-tool.md +3 -3
- package/.docs/reference/workers/overview.md +2 -2
- package/.docs/reference/workflows/run-methods/resume.md +1 -1
- package/.docs/reference/workflows/run-methods/start.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workflows/run.md +1 -1
- package/.docs/reference/workflows/workflow.md +2 -0
- package/.docs/reference/workspace/factory-sandbox.md +24 -8
- package/.docs/reference/workspace/platform-sandbox.md +22 -7
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +5 -5
- package/dist/index.js +1 -1
- package/dist/{src-BDrEqwuY.js → src-CwUXyWAK.js} +3 -3
- package/dist/src-CwUXyWAK.js.map +1 -0
- package/dist/stdio.js +1 -1
- package/dist/tools/embedded-docs.d.ts.map +1 -1
- package/package.json +4 -5
- package/.docs/docs/mastra-platform/connect/channels.md +0 -165
- package/.docs/docs/mastra-platform/connect/overview.md +0 -102
- package/.docs/docs/mastra-platform/connect/providers.md +0 -66
- package/.docs/docs/mastra-platform/connect/tools.md +0 -151
- package/.docs/models/providers/requesty.md +0 -261
- package/dist/src-BDrEqwuY.js.map +0 -1
|
@@ -8,7 +8,7 @@ This page documents generated toolsets for 28 providers (1076 tools in this vers
|
|
|
8
8
|
|
|
9
9
|
Tool keys are stable identifiers of the form `<provider>_<action>` and are the values accepted by `allowTools` and `disallowTools`. Toolsets are versioned with the package: the exact list depends on the installed `@mastra/connect` version, and this page reflects the version it was generated from.
|
|
10
10
|
|
|
11
|
-
MCP providers (Attio, Canva, Clay, Neon, Render, Robinhood, and Sanity) serve their tools from their hosted MCP servers at runtime and aren't listed here. See [MCP providers](https://mastra.ai/
|
|
11
|
+
MCP providers ([Attio](https://mastra.ai/integrations/crm/attio), [Canva](https://mastra.ai/integrations/other/canva), [Clay](https://mastra.ai/integrations/crm/clay), [Neon](https://mastra.ai/integrations/databases/neon), [Render](https://mastra.ai/integrations/deploy/render), [Robinhood](https://mastra.ai/integrations/other/robinhood), and [Sanity](https://mastra.ai/integrations/other/sanity)) serve their tools from their hosted MCP servers at runtime and aren't listed here. See [MCP providers](https://mastra.ai/reference/connect/tools) for how `tools()` discovers them.
|
|
12
12
|
|
|
13
13
|
| Provider | Provider ID | Tools |
|
|
14
14
|
| ----------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- |
|
|
@@ -30,9 +30,9 @@ MCP providers (Attio, Canva, Clay, Neon, Render, Robinhood, and Sanity) serve th
|
|
|
30
30
|
|  [Microsoft Teams](#microsoft-teams) | `microsoft-teams` | 25 |
|
|
31
31
|
|  [Microsoft Word](#microsoft-word) | `microsoft-word` | 18 |
|
|
32
32
|
|  [Notion](#notion) | `notion` | 44 |
|
|
33
|
-
| [OneDrive](#onedrive)
|
|
33
|
+
|  [OneDrive](#onedrive) | `one-drive` | 20 |
|
|
34
34
|
|  [OpenAI](#openai) | `openai` | 26 |
|
|
35
|
-
|  [Microsoft Outlook](#microsoft-outlook) | `outlook` | 30 |
|
|
36
36
|
|  [PostHog](#posthog) | `posthog` | 67 |
|
|
37
37
|
|  [Resend](#resend) | `resend` | 80 |
|
|
38
38
|
|  [SharePoint Online](#sharepoint-online) | `sharepoint-online` | 53 |
|
|
@@ -1010,6 +1010,8 @@ Provider ID: `posthog` · 67 tools
|
|
|
1010
1010
|
|
|
1011
1011
|
Provider ID: `resend` · 80 tools
|
|
1012
1012
|
|
|
1013
|
+
> **Note:** Connect Resend with an API key that has **Full access** permission. A **Sending access** key fails to connect because Mastra checks a new key by listing your domains, which sending access keys can't do.
|
|
1014
|
+
|
|
1013
1015
|
| Tool | Description |
|
|
1014
1016
|
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1015
1017
|
| `resend_add_contact_to_segment` | Add a contact to a segment in Resend. |
|
|
@@ -21,7 +21,7 @@ export const opsAgent = new Agent({
|
|
|
21
21
|
|
|
22
22
|
Returns: `ToolsResolver`, a resolver producing a flat tool record keyed by tool key (for example `linear_create_issue`). See [The resolver](#the-resolver).
|
|
23
23
|
|
|
24
|
-
See [Connect](https://mastra.ai/docs/mastra-platform/connect
|
|
24
|
+
See [Connect](https://mastra.ai/docs/mastra-platform/connect) to get started.
|
|
25
25
|
|
|
26
26
|
## Parameters
|
|
27
27
|
|
|
@@ -74,12 +74,16 @@ Each value in the `providers` record form is `true`, `false`, or a `ToolsProvide
|
|
|
74
74
|
|
|
75
75
|
### ConnectClientOptions
|
|
76
76
|
|
|
77
|
-
Every field falls back to an environment variable, so a fully env-configured app can pass nothing.
|
|
77
|
+
Every field except `fetch` and `resourceId` falls back to an environment variable. `fetch` defaults to `globalThis.fetch`, and `resourceId` has no fallback, so a fully env-configured app that doesn't scope calls to a resource can pass nothing.
|
|
78
78
|
|
|
79
79
|
**accessToken** (`string`): Platform access token. Falls back to MASTRA_PLATFORM_ACCESS_TOKEN, then MASTRA_PLATFORM_SECRET_KEY.
|
|
80
80
|
|
|
81
81
|
**orgId** (`string`): Organization ID. Falls back to MASTRA_ORG_ID; sent as the x-organization-id header when present.
|
|
82
82
|
|
|
83
|
+
**projectId** (`string`): Project ID, sent as the x-mastra-project-id header so the platform can attribute proxy activity to the project. Falls back to MASTRA_PROJECT_ID; the header is omitted when absent.
|
|
84
|
+
|
|
85
|
+
**resourceId** (`string`): End-user resource key the client acts for, sent as the x-mastra-resource-id header. Connection listings are scoped to global connections plus that resource's connections. Has no environment variable fallback.
|
|
86
|
+
|
|
83
87
|
**baseUrl** (`string`): Connect API base URL. Falls back to MASTRA_INTEGRATIONS_API_URL, then the regional default from MASTRA_PLATFORM_REGION (us or eu), then https\://integrations.mastra.ai.
|
|
84
88
|
|
|
85
89
|
**fetch** (`typeof globalThis.fetch`): Fetch implementation, for testing or custom transports. Defaults to globalThis.fetch.
|
|
@@ -104,7 +108,34 @@ The resolver also exposes methods for manual control:
|
|
|
104
108
|
|
|
105
109
|
- `refresh()` fetches from the platform immediately, then updates the cache and returns the tool record. Rejects if the platform fetch fails.
|
|
106
110
|
- `disconnect()` clears the cached snapshots and closes the MCP transports of the state behind this resolver. Resolvers created with identical options share that state, so this disconnects them too. A later resolution rebuilds the state, and already-returned MCP tools reconnect on their next call.
|
|
107
|
-
- `with(extra)` returns a new resolver that merges extra tools into every resolution, giving extras priority on key collision. It accepts a static tool record or a function (sync or async) and calls chain. For the same merge using a spread of the resolver's result in a `tools` callback, see [
|
|
111
|
+
- `with(extra)` returns a new resolver that merges extra tools into every resolution, giving extras priority on key collision. It accepts a static tool record or a function (sync or async) and calls chain. For the same merge using a spread of the resolver's result in a `tools` callback, see [Add tools to an agent](https://mastra.ai/docs/mastra-platform/connect).
|
|
112
|
+
|
|
113
|
+
To filter on something other than tool keys, or on data that options can't express, post-process the resolved record in the agent's `tools` function. Create the resolver once, outside the function, so its cache is shared:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
import { Agent } from '@mastra/core/agent'
|
|
117
|
+
import { tools } from '@mastra/connect'
|
|
118
|
+
|
|
119
|
+
const connectTools = tools({ providers: ['linear'] })
|
|
120
|
+
const viewerTools = new Set(['linear_list_issues'])
|
|
121
|
+
|
|
122
|
+
export const opsAgent = new Agent({
|
|
123
|
+
id: 'ops',
|
|
124
|
+
name: 'ops',
|
|
125
|
+
instructions: 'You help the team track work in Linear.',
|
|
126
|
+
model: 'openai/gpt-6-luna',
|
|
127
|
+
tools: async ctx => {
|
|
128
|
+
const all = await connectTools(ctx)
|
|
129
|
+
|
|
130
|
+
if (ctx.requestContext?.get('role') === 'admin') {
|
|
131
|
+
return all
|
|
132
|
+
}
|
|
133
|
+
return Object.fromEntries(Object.entries(all).filter(([key]) => viewerTools.has(key)))
|
|
134
|
+
},
|
|
135
|
+
})
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Only the `admin` role gets every tool. Any other or missing role gets the viewer subset. Set `role` in trusted server-side code based on the authenticated user. [Vary tools by channel](https://mastra.ai/reference/connect/channels) applies the same pattern to channel messages.
|
|
108
139
|
|
|
109
140
|
Error handling depends on the cause:
|
|
110
141
|
|
|
@@ -47,7 +47,7 @@ const result = await run.start({ inputData: { name: 'Ada' } })
|
|
|
47
47
|
|
|
48
48
|
## Returns
|
|
49
49
|
|
|
50
|
-
A promise that resolves once the definition is validated
|
|
50
|
+
A promise that resolves once the definition is validated and registered, and persisted when storage provides a `workflowDefinitions` store.
|
|
51
51
|
|
|
52
52
|
## Behavior
|
|
53
53
|
|
|
@@ -23,7 +23,7 @@ mastra.addGateway(new MyCustomGateway())
|
|
|
23
23
|
|
|
24
24
|
## Parameters
|
|
25
25
|
|
|
26
|
-
**gateway** (`
|
|
26
|
+
**gateway** (`MastraModelGatewayInterface`): The gateway instance to add
|
|
27
27
|
|
|
28
28
|
**key** (`string`): Optional registration key. If not provided, uses gateway.getId()
|
|
29
29
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Mastra.getAgent()
|
|
6
6
|
|
|
7
|
-
The `.getAgent()` method is used to retrieve an agent. The method accepts
|
|
7
|
+
The `.getAgent()` method is used to retrieve an agent. The method accepts the agent's name and an optional version selector. Passing a version selector returns a promise.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -16,9 +16,11 @@ mastra.getAgent('testAgent')
|
|
|
16
16
|
|
|
17
17
|
**name** (`TAgentName extends keyof TAgents`): The name of the agent to retrieve. Must be a valid agent name that exists in the Mastra configuration.
|
|
18
18
|
|
|
19
|
+
**version** (`{ versionId: string } | { status?: 'draft' | 'published' }`): Selects a stored version of the agent. When provided, the method returns a promise.
|
|
20
|
+
|
|
19
21
|
## Returns
|
|
20
22
|
|
|
21
|
-
**agent** (`TAgents[TAgentName]
|
|
23
|
+
**agent** (`TAgents[TAgentName] | Promise<TAgents[TAgentName]>`): The agent instance with the specified name, or a promise that resolves to it when version is provided. Throws an error if the agent is not found.
|
|
22
24
|
|
|
23
25
|
## Related
|
|
24
26
|
|
|
@@ -31,7 +31,7 @@ This method doesn't accept any parameters.
|
|
|
31
31
|
|
|
32
32
|
## Returns
|
|
33
33
|
|
|
34
|
-
**editor** (`
|
|
34
|
+
**editor** (`IMastraEditor | undefined`): The configured editor instance, or undefined if no editor has been configured.
|
|
35
35
|
|
|
36
36
|
## Related
|
|
37
37
|
|
|
@@ -34,7 +34,20 @@ console.log(gateway.name) // 'My Custom Gateway'
|
|
|
34
34
|
|
|
35
35
|
## Returns
|
|
36
36
|
|
|
37
|
-
**gateway** (`
|
|
37
|
+
**gateway** (`MastraModelGatewayInterface`): The gateway instance
|
|
38
|
+
|
|
39
|
+
## Throws
|
|
40
|
+
|
|
41
|
+
Throws a `MastraError` with ID `MASTRA_GET_GATEWAY_BY_ID_NOT_FOUND` if no registered gateway has the specified ID. Wrap the call in `try`/`catch` when the gateway might not be registered:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
let gateway
|
|
45
|
+
try {
|
|
46
|
+
gateway = mastra.getGatewayById('my-custom-gateway')
|
|
47
|
+
} catch {
|
|
48
|
+
// Gateway is not registered
|
|
49
|
+
}
|
|
50
|
+
```
|
|
38
51
|
|
|
39
52
|
## Related
|
|
40
53
|
|
|
@@ -20,11 +20,11 @@ const thread = await memory.createThread({
|
|
|
20
20
|
|
|
21
21
|
## Parameters
|
|
22
22
|
|
|
23
|
-
**
|
|
23
|
+
**name** (`TMemoryName extends keyof TMemory`): The registry key of the memory instance to retrieve. Must match a key used when registering memory in the Mastra constructor.
|
|
24
24
|
|
|
25
25
|
## Returns
|
|
26
26
|
|
|
27
|
-
**memory** (`TMemory[
|
|
27
|
+
**memory** (`TMemory[TMemoryName]`): The memory instance with the specified key. Throws an error if the memory is not found.
|
|
28
28
|
|
|
29
29
|
## Example: Registering and retrieving memory
|
|
30
30
|
|
|
@@ -18,7 +18,7 @@ This method doesn't accept any parameters.
|
|
|
18
18
|
|
|
19
19
|
## Returns
|
|
20
20
|
|
|
21
|
-
**storage** (`MastraCompositeStore | undefined`): The configured storage instance,
|
|
21
|
+
**storage** (`MastraCompositeStore | undefined`): The configured storage instance. When no storage is configured, Mastra uses a default InMemoryStore, which this method returns.
|
|
22
22
|
|
|
23
23
|
## Related
|
|
24
24
|
|
|
@@ -9,7 +9,7 @@ The `.listMemory()` method returns all memory instances registered with the Mast
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
const memoryInstances = mastra.listMemory()
|
|
12
|
+
const memoryInstances = mastra.listMemory() ?? {}
|
|
13
13
|
|
|
14
14
|
for (const [key, memory] of Object.entries(memoryInstances)) {
|
|
15
15
|
console.log(`Memory "${key}": ${memory.id}`)
|
|
@@ -22,7 +22,7 @@ This method takes no parameters.
|
|
|
22
22
|
|
|
23
23
|
## Returns
|
|
24
24
|
|
|
25
|
-
**memory** (`Record<string, MastraMemory
|
|
25
|
+
**memory** (`Record<string, MastraMemory> | undefined`): An object containing all registered memory instances, keyed by their registry keys.
|
|
26
26
|
|
|
27
27
|
## Example: Checking registered memory
|
|
28
28
|
|
|
@@ -49,7 +49,7 @@ const mastra = new Mastra({
|
|
|
49
49
|
})
|
|
50
50
|
|
|
51
51
|
// List all registered memory instances
|
|
52
|
-
const allMemory = mastra.listMemory()
|
|
52
|
+
const allMemory = mastra.listMemory() ?? {}
|
|
53
53
|
console.log(Object.keys(allMemory)) // ["conversationMemory", "analyticsMemory"]
|
|
54
54
|
```
|
|
55
55
|
|
|
@@ -15,7 +15,7 @@ import { mastra } from './mastra'
|
|
|
15
15
|
const allScorers = mastra.listScorers()
|
|
16
16
|
|
|
17
17
|
// Access a specific scorer
|
|
18
|
-
const myScorer = allScorers
|
|
18
|
+
const myScorer = allScorers?.relevancyScorer
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Parameters
|
|
@@ -24,7 +24,7 @@ This method takes no parameters.
|
|
|
24
24
|
|
|
25
25
|
## Returns
|
|
26
26
|
|
|
27
|
-
**scorers** (`Record<string, MastraScorer> | undefined`): An object containing all registered scorers, where keys are scorer names and values are MastraScorer instances. Returns
|
|
27
|
+
**scorers** (`Record<string, MastraScorer> | undefined`): An object containing all registered scorers, where keys are scorer names and values are MastraScorer instances. Returns an empty object if no scorers are registered.
|
|
28
28
|
|
|
29
29
|
## Related
|
|
30
30
|
|
|
@@ -18,7 +18,7 @@ This method doesn't accept any parameters.
|
|
|
18
18
|
|
|
19
19
|
## Returns
|
|
20
20
|
|
|
21
|
-
**vectors** (`TVectors`): A record of all configured vector stores, where keys are vector store names and values are vector store instances.
|
|
21
|
+
**vectors** (`TVectors | undefined`): A record of all configured vector stores, where keys are vector store names and values are vector store instances.
|
|
22
22
|
|
|
23
23
|
## Related
|
|
24
24
|
|
|
@@ -137,7 +137,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
137
137
|
|
|
138
138
|
**recovery** (`MastraRecoveryConfig`): Boot-time recovery behavior for orphaned agent and workflow runs. See Crash recovery. (Default: `{ durableAgents: 'off', workflows: 'auto', workflowConcurrency: 5 }`)
|
|
139
139
|
|
|
140
|
-
**recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. This also controls the default snapshot-persistence policy for durable agents: running checkpoints are only written when set to 'auto' (or when an agent sets a custom shouldPersistSnapshot that includes running). Recovery
|
|
140
|
+
**recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. This also controls the default snapshot-persistence policy for durable agents: running checkpoints are only written when set to 'auto' (or when an agent sets a custom shouldPersistSnapshot that includes running). Recovery can run an interrupted tool call again and request a new model response in place of one that wasn't saved, so tools must be idempotent. See make tools safe to repeat.
|
|
141
141
|
|
|
142
142
|
**recovery.workflows** (`'auto' | 'off'`): Set to 'off' to skip restarting active workflow runs on server boot. Individual workflows can also opt out with autoRestartActiveRuns: false.
|
|
143
143
|
|
|
@@ -47,7 +47,6 @@ The scorer extracts and analyzes several types of elements:
|
|
|
47
47
|
The extraction process includes:
|
|
48
48
|
|
|
49
49
|
- Normalization of text (removing diacritics, converting to lowercase)
|
|
50
|
-
- Splitting camelCase words
|
|
51
50
|
- Handling of word boundaries
|
|
52
51
|
- Special handling of short words (3 characters or less)
|
|
53
52
|
- Deduplication of elements
|
|
@@ -18,12 +18,10 @@ This function returns an instance of the MastraScorer class. See the [MastraScor
|
|
|
18
18
|
|
|
19
19
|
## `.run()` returns
|
|
20
20
|
|
|
21
|
-
**runId** (`string`): The id of the run
|
|
21
|
+
**runId** (`string`): The id of the run.
|
|
22
22
|
|
|
23
23
|
**preprocessStepResult** (`object`): Object with processed input and output: { processedInput: string, processedOutput: string }
|
|
24
24
|
|
|
25
|
-
**analyzeStepResult** (`object`): Object with similarity: { similarity: number }
|
|
26
|
-
|
|
27
25
|
**score** (`number`): Similarity score (0-1) where 1 indicates perfect similarity.
|
|
28
26
|
|
|
29
27
|
## Scoring details
|
|
@@ -45,7 +45,9 @@ const scorer = createScorer({
|
|
|
45
45
|
|
|
46
46
|
**judge.model** (`LanguageModel`): The LLM model instance to use for evaluation.
|
|
47
47
|
|
|
48
|
-
**judge.instructions** (`
|
|
48
|
+
**judge.instructions** (`SystemMessage | ({ requestContext: RequestContext }) => SystemMessage | Promise<SystemMessage>`): System instructions for the LLM. Can be a string, array of strings, system message object, array of system messages, or a function that returns any of these types.
|
|
49
|
+
|
|
50
|
+
**judge.requestContext** (`RequestContext`): Values available to the judge's dynamic instructions, tools, and processors. Values from the run's requestContext override these values. scorer.run doesn't pass reserved Mastra keys or MastraMemory from the run to the judge, because they could put the judge on the caller's memory thread or give it credentials such as the auth token. To give the judge a reserved key, set it on this option. Only the scorer-level judge accepts this option.
|
|
49
51
|
|
|
50
52
|
**judge.jsonPromptInjection** (`boolean | 'system' | 'inline' | 'auto'`): Controls how the judge's structured output schema reaches the model. Defaults to 'auto', which uses native structured output when supported and inline prompt injection otherwise. Explicit values override automatic routing.
|
|
51
53
|
|
|
@@ -268,7 +270,9 @@ The method can return any value. The returned value will be available to subsequ
|
|
|
268
270
|
|
|
269
271
|
**Required** step that computes the final numerical score.
|
|
270
272
|
|
|
271
|
-
**Function Mode:** Function: `({ run, results }) => number
|
|
273
|
+
**Function Mode:** Function: `({ run, results }) => number | NotScorable | Promise<number | NotScorable>`
|
|
274
|
+
|
|
275
|
+
Return [`notScorable()`](https://mastra.ai/reference/evals/not-scorable) instead of a number to finish the run without a score.
|
|
272
276
|
|
|
273
277
|
**run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g. \[{ role: 'user', content: 'hello world' }]. If the scorer is used in a workflow, this will be the input of the workflow.
|
|
274
278
|
|
|
@@ -282,8 +286,8 @@ The method can return any value. The returned value will be available to subsequ
|
|
|
282
286
|
|
|
283
287
|
**results.analyzeStepResult** (`any`): Result from analyze step, if defined (optional).
|
|
284
288
|
|
|
285
|
-
Returns: `number`\
|
|
286
|
-
|
|
289
|
+
Returns: `number | NotScorable`\
|
|
290
|
+
Return a numerical score, or `notScorable()` to finish the run without a score.
|
|
287
291
|
|
|
288
292
|
**Prompt Object Mode:**
|
|
289
293
|
|
|
@@ -10,7 +10,7 @@ The `createFaithfulnessScorer()` function evaluates how factually accurate an LL
|
|
|
10
10
|
|
|
11
11
|
The `createFaithfulnessScorer()` function accepts a single options object with the following properties:
|
|
12
12
|
|
|
13
|
-
**model** (`
|
|
13
|
+
**model** (`MastraModelConfig`): Configuration for the model used to evaluate faithfulness.
|
|
14
14
|
|
|
15
15
|
**options** (`{ context?: string[]; scale?: number }`): Configuration options for the scorer.
|
|
16
16
|
|
|
@@ -14,7 +14,7 @@ The `createHallucinationScorer()` function accepts a single options object with
|
|
|
14
14
|
|
|
15
15
|
**options** (`Options`): Configuration options.
|
|
16
16
|
|
|
17
|
-
**options.scale** (`number`): Maximum score value.
|
|
17
|
+
**options.scale** (`number`): Maximum score value. A value of 0 falls back to 1.
|
|
18
18
|
|
|
19
19
|
**options.context** (`string[]`): Static context strings to use as ground truth for hallucination detection.
|
|
20
20
|
|
|
@@ -65,7 +65,7 @@ The scorer evaluates hallucination through contradiction detection and unsupport
|
|
|
65
65
|
- Divides by total statements
|
|
66
66
|
- Scales to configured range
|
|
67
67
|
|
|
68
|
-
Final score: `min(1, hallucinated_statements / total_statements) * scale
|
|
68
|
+
Final score: `min(1, hallucinated_statements / total_statements) * (scale || 1)`, rounded to two decimal places, when `total_statements > 0`, otherwise `0`.
|
|
69
69
|
|
|
70
70
|
### Important Considerations
|
|
71
71
|
|
|
@@ -119,13 +119,20 @@ Checks if noise causes the agent to generate false or fabricated information tha
|
|
|
119
119
|
### Formula
|
|
120
120
|
|
|
121
121
|
```text
|
|
122
|
-
|
|
122
|
+
selected_score = |llm_score - calculated_score| > discrepancy_threshold
|
|
123
|
+
? min(llm_score, calculated_score)
|
|
124
|
+
: llm_score
|
|
125
|
+
|
|
126
|
+
Final Score = max(0, selected_score - issues_penalty)
|
|
123
127
|
```
|
|
124
128
|
|
|
129
|
+
The final score is rounded to two decimal places.
|
|
130
|
+
|
|
125
131
|
Where:
|
|
126
132
|
|
|
127
133
|
- `llm_score` = Direct robustness score from LLM analysis
|
|
128
134
|
- `calculated_score` = Average of impact weights across dimensions
|
|
135
|
+
- `discrepancy_threshold` = `scoring.discrepancyThreshold` (default `0.2`)
|
|
129
136
|
- `issues_penalty` = min(major_issues × penalty_rate, max_penalty)
|
|
130
137
|
|
|
131
138
|
### Impact Level Weights
|
|
@@ -189,7 +189,7 @@ Combines all system messages into a single prompt string, joined with double new
|
|
|
189
189
|
|
|
190
190
|
### `extractToolCalls`
|
|
191
191
|
|
|
192
|
-
Extracts information about
|
|
192
|
+
Extracts information about tool calls from the run output, excluding partial calls (`partial-call` state), including tool names, call IDs, and their positions in the message array.
|
|
193
193
|
|
|
194
194
|
```typescript
|
|
195
195
|
const toolUsageScorer = createScorer({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Tools
|
|
6
6
|
|
|
7
|
-
A file-based agent discovers tools from `.ts` and `.js` files directly under its `tools/` directory. Each discovered file is imported at build time
|
|
7
|
+
A file-based agent discovers tools from `.ts` and `.js` files directly under its `tools/` directory. Each discovered file is imported at build time and must default-export a tool. Any tool an agent's `tools` option accepts works, such as a [`createTool()`](https://mastra.ai/reference/tools/create-tool) result or a Vercel AI SDK `tool()`. The filename without its extension becomes the tool key the model can call.
|
|
8
8
|
|
|
9
9
|
Use this page for the file-based convention. For tool schemas, execution options, output shaping, and approval options, see the [`createTool()` reference](https://mastra.ai/reference/tools/create-tool).
|
|
10
10
|
|
|
@@ -46,14 +46,14 @@ Because nested directories aren't discovered as tools, group related tools with
|
|
|
46
46
|
|
|
47
47
|
## Tool options
|
|
48
48
|
|
|
49
|
-
The file-based convention only controls where the tool lives and how it's registered.
|
|
49
|
+
The file-based convention only controls where the tool lives and how it's registered. Options come from the tool itself. For tools built with `createTool()`:
|
|
50
50
|
|
|
51
51
|
- Use `description` to tell the model when to call the tool.
|
|
52
52
|
- Use `inputSchema` and `outputSchema` for structured inputs and outputs.
|
|
53
53
|
- Use `toModelOutput` when the model should see a different shape than the raw value returned from `execute`.
|
|
54
54
|
- Use `requireApproval` when a tool needs human confirmation before execution.
|
|
55
55
|
|
|
56
|
-
See the [`createTool()` reference](https://mastra.ai/reference/tools/create-tool) for all options and [tool approval](https://mastra.ai/docs/harness/agent-controller) for the approval flow.
|
|
56
|
+
See the [`createTool()` reference](https://mastra.ai/reference/tools/create-tool) for all options and [tool approval](https://mastra.ai/docs/harness/agent-controller) for the approval flow. Vercel AI SDK tools use the [AI SDK `tool()` API](https://ai-sdk.dev/docs/reference/ai-sdk-core/tool) instead.
|
|
57
57
|
|
|
58
58
|
## Runtime boundary
|
|
59
59
|
|
package/.docs/reference/index.md
CHANGED
|
@@ -223,6 +223,12 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
223
223
|
- [Tools](https://mastra.ai/reference/file-based-agents/tools)
|
|
224
224
|
- [Workflows](https://mastra.ai/reference/file-based-agents/workflows)
|
|
225
225
|
- [Workspace](https://mastra.ai/reference/file-based-agents/workspace)
|
|
226
|
+
- [Knowledge Class](https://mastra.ai/reference/knowledge/knowledge-class)
|
|
227
|
+
- [Knowledge Tools](https://mastra.ai/reference/knowledge/knowledge-tools)
|
|
228
|
+
- [knowledgeMemoryScopes()](https://mastra.ai/reference/knowledge/knowledge-memory-scopes)
|
|
229
|
+
- [Limits](https://mastra.ai/reference/knowledge/limits)
|
|
230
|
+
- [Scope declarations](https://mastra.ai/reference/knowledge/scope-declarations)
|
|
231
|
+
- [Tool instructions](https://mastra.ai/reference/knowledge/tool-instructions)
|
|
226
232
|
- [Cloned Thread Utilities](https://mastra.ai/reference/memory/clone-utilities)
|
|
227
233
|
- [Memory Class](https://mastra.ai/reference/memory/memory-class)
|
|
228
234
|
- [Observational Memory](https://mastra.ai/reference/memory/observational-memory)
|
|
@@ -290,6 +296,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
290
296
|
- [ResponseCache](https://mastra.ai/reference/processors/response-cache)
|
|
291
297
|
- [SemanticRecall](https://mastra.ai/reference/processors/semantic-recall-processor)
|
|
292
298
|
- [SkillSearchProcessor](https://mastra.ai/reference/processors/skill-search-processor)
|
|
299
|
+
- [SkillsProcessor](https://mastra.ai/reference/processors/skills-processor)
|
|
293
300
|
- [StreamErrorRetryProcessor](https://mastra.ai/reference/processors/stream-error-retry-processor)
|
|
294
301
|
- [SystemPromptScrubber](https://mastra.ai/reference/processors/system-prompt-scrubber)
|
|
295
302
|
- [TokenCostControl](https://mastra.ai/reference/processors/token-cost-control)
|
|
@@ -327,6 +334,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
327
334
|
- [Express Adapter](https://mastra.ai/reference/server/express-adapter)
|
|
328
335
|
- [Fastify Adapter](https://mastra.ai/reference/server/fastify-adapter)
|
|
329
336
|
- [Hono Adapter](https://mastra.ai/reference/server/hono-adapter)
|
|
337
|
+
- [invokeRoute()](https://mastra.ai/reference/server/invoke-route)
|
|
330
338
|
- [Koa Adapter](https://mastra.ai/reference/server/koa-adapter)
|
|
331
339
|
- [MastraServer](https://mastra.ai/reference/server/mastra-server)
|
|
332
340
|
- [NestJS Adapter](https://mastra.ai/reference/server/nestjs-adapter)
|