Skip to main content

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
Direct link to 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
Direct link to Parameters

This method doesn't accept any parameters.

Returns
Direct link to Returns

editor:

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