跳到主要内容
非官方简体中文翻译,内容版权归 Mastra 所有,遵循 Apache-2.0 许可。

Mastra.getEditor()

The .getEditor() method is used to retrieve the editor instance that has been configured on the Mastra instance. The editor exposes CRUD namespaces for managing stored agents, prompt blocks, MCP clients, scorers, skills, and workspaces programmatically.

Usage example
Usage example的直接链接

import { Mastra } from '@mastra/core'
import { MastraEditor } from '@mastra/editor'

const mastra = new Mastra({
editor: new MastraEditor(),
})

const editor = mastra.getEditor()

const agent = await editor?.agent.create({
id: 'support-agent',
name: 'Support Agent',
instructions: 'Help customers with their questions.',
})

Parameters
Parameters的直接链接

This method doesn't accept any parameters.

Returns
Returns的直接链接

editor:

MastraEditor | undefined
The configured editor instance, or undefined if no editor has been configured.
On this page