@mastra/core
Version:
28 lines (16 loc) • 1.03 kB
Markdown
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
# Mastra.removeWorkspace()
The `.removeWorkspace()` method removes a workspace from the Mastra runtime registry. Pass `{ destroy: true }` to destroy the workspace before it's removed.
## Usage example
```typescript
await mastra.removeWorkspace('workspace-123', { destroy: true })
```
## 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.
## 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.
## Related
- [Workspace overview](https://mastra.ai/docs/workspace/overview)
- [Workspace class](https://mastra.ai/reference/workspace/workspace-class)