Mastra.removeWorkspace()
The .removeWorkspace() method removes a workspace from the Mastra runtime registry. Pass { destroy: true } to destroy the workspace before it is removed.
Usage exampleDirect link to Usage example
await mastra.removeWorkspace('workspace-123', { destroy: true })
ParametersDirect link to Parameters
id:
string
The ID of the workspace to remove.
options?:
{ destroy?: boolean }
Optional cleanup behavior. Set `destroy` to `true` to call `workspace.destroy()` before removing the workspace.
ReturnsDirect link to Returns
removed:
Promise<boolean>
`true` when a workspace was removed. `false` when no workspace exists for the ID.
When destroy is true and workspace.destroy() throws, the call rejects with that error and the workspace remains registered so the caller can retry cleanup.