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

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
Usage example的直接链接

await mastra.removeWorkspace('workspace-123', { destroy: true })

Parameters
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
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.

On this page