> Discover all available pages from the documentation index: https://mastra.zisheng.pro/llms.txt # Mastra.removeWorkspace() `.removeWorkspace()` 方法从 Mastra 运行时注册表中移除 Workspace。传入 `{ destroy: true }` 可在移除前销毁 Workspace。 ## 使用示例 ```typescript await mastra.removeWorkspace('workspace-123', { destroy: true }) ``` ## 参数 **id** (`string`): 要移除的 Workspace ID。 **options** (`{ destroy?: boolean }`): 可选的清理行为。将 destroy 设为 true,可在移除 Workspace 前调用 workspace.destroy()。 ## 返回值 **removed** (`Promise`): 成功移除 Workspace 时为 true。不存在具有该 ID 的 Workspace 时为 false。 当 `destroy` 为 `true` 且 `workspace.destroy()` 抛出错误时,此调用会以该错误拒绝,Workspace 仍保持注册状态,以便调用方重试清理。 ## 相关内容 - [Workspace 概览](https://mastra.zisheng.pro/docs/workspace/overview) - [Workspace 类](https://mastra.zisheng.pro/reference/workspace/workspace-class)