delete_workspace
Permanently remove a workspace by specifying its unique ID using the provided GraphQL API endpoint, ensuring efficient management of AFFiNE workspace resources.
Instructions
Delete a workspace permanently
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Workspace ID |
Implementation Reference
- src/tools/workspaces.ts:431-445 (handler)The handler function that implements the core logic of the 'delete_workspace' tool. It performs a GraphQL mutation to delete the specified workspace by ID and returns a success or error response.const deleteWorkspaceHandler = async ({ id }: { id: string }) => { try { const mutation = ` mutation DeleteWorkspace($id: String!) { deleteWorkspace(id: $id) } `; const data = await gql.request<{ deleteWorkspace: boolean }>(mutation, { id }); return text({ success: data.deleteWorkspace, message: "Workspace deleted successfully" }); } catch (error: any) { return text({ error: error.message }); } };
- src/tools/workspaces.ts:446-456 (registration)Registration of the 'delete_workspace' tool, including its metadata, input schema (requiring a workspace ID), and binding to the deleteWorkspaceHandler.server.registerTool( "delete_workspace", { title: "Delete Workspace", description: "Delete a workspace permanently", inputSchema: { id: z.string().describe("Workspace ID") } }, deleteWorkspaceHandler as any );
- src/tools/workspaces.ts:457-467 (registration)Secondary registration of an alias 'affine_delete_workspace' tool using the same handler and schema.server.registerTool( "affine_delete_workspace", { title: "Delete Workspace", description: "Delete a workspace permanently", inputSchema: { id: z.string().describe("Workspace ID") } }, deleteWorkspaceHandler as any );