affine_cleanup_blobs
Permanently remove deleted blobs in AFFiNE workspaces to optimize storage. Requires a workspace ID to target specific cleanup tasks.
Instructions
Permanently remove deleted blobs to free up storage.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspaceId | Yes | Workspace ID |
Implementation Reference
- src/tools/blobStorage.ts:104-120 (handler)The async handler function that executes the tool logic: performs a GraphQL mutation to permanently release deleted blobs in the specified workspace, freeing up storage. Returns success status and count of released blobs or error.const cleanupBlobsHandler = async ({ workspaceId }: { workspaceId: string }) => { try { const mutation = ` mutation ReleaseDeletedBlobs($workspaceId: String!) { releaseDeletedBlobs(workspaceId: $workspaceId) } `; const data = await gql.request<{ releaseDeletedBlobs: number }>(mutation, { workspaceId }); return text({ success: true, workspaceId, blobsReleased: data.releaseDeletedBlobs }); } catch (error: any) { return text({ error: error.message }); } };
- src/tools/blobStorage.ts:121-131 (registration)Registration of the 'affine_cleanup_blobs' MCP tool, including input schema validation using Zod and linking to the handler function.server.registerTool( "affine_cleanup_blobs", { title: "Cleanup Deleted Blobs", description: "Permanently remove deleted blobs to free up storage.", inputSchema: { workspaceId: z.string().describe("Workspace ID") } }, cleanupBlobsHandler as any );
- src/index.ts:73-73 (registration)Top-level invocation of the registerBlobTools function during server setup, which registers the affine_cleanup_blobs tool among others.registerBlobTools(server, gql);