revoke_doc
Remove public access to a specific document in an AFFiNE workspace by specifying the docId using the GraphQL API.
Instructions
Revoke a doc's public access.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docId | Yes | ||
| workspaceId | No |
Implementation Reference
- src/tools/docs.ts:215-223 (handler)The main handler function that executes the revoke_doc tool logic by sending a GraphQL mutation to revoke public access for the specified document.const revokeDocHandler = async (parsed: { workspaceId?: string; docId: string }) => { const workspaceId = parsed.workspaceId || defaults.workspaceId; if (!workspaceId) { throw new Error("workspaceId is required. Provide it as a parameter or set AFFINE_WORKSPACE_ID in environment."); } const mutation = `mutation RevokeDoc($workspaceId:String!,$docId:String!){ revokePublicDoc(workspaceId:$workspaceId, docId:$docId){ id workspaceId public } }`; const data = await gql.request<{ revokePublicDoc: any }>(mutation, { workspaceId, docId: parsed.docId }); return text(data.revokePublicDoc); };
- src/tools/docs.ts:224-235 (registration)Registration of the 'revoke_doc' tool, including its input schema and reference to the handler function.server.registerTool( "revoke_doc", { title: "Revoke Document", description: "Revoke a doc's public access.", inputSchema: { workspaceId: z.string().optional(), docId: z.string() } }, revokeDocHandler as any );
- src/tools/docs.ts:229-232 (schema)Input schema definition for the revoke_doc tool using Zod for validation.inputSchema: { workspaceId: z.string().optional(), docId: z.string() }