Skip to main content
Glama

affine_recover_doc

Restore a document to a specific previous version using its timestamp and unique identifier within an AFFiNE workspace, ensuring precise recovery of content.

Instructions

Recover a doc to a previous timestamp.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guidYes
timestampYes
workspaceIdNo

Implementation Reference

  • The async handler function that executes the tool logic: performs a GraphQL mutation to recover the document at a specific timestamp.
    const recoverDocHandler = async (parsed: { workspaceId?: string; guid: string; timestamp: string }) => { const workspaceId = parsed.workspaceId || defaults.workspaceId || parsed.workspaceId; if (!workspaceId) throw new Error("workspaceId required (or set AFFINE_WORKSPACE_ID)"); const mutation = `mutation Recover($workspaceId:String!,$guid:String!,$timestamp:DateTime!){ recoverDoc(workspaceId:$workspaceId, guid:$guid, timestamp:$timestamp) }`; const data = await gql.request<{ recoverDoc: string }>(mutation, { workspaceId, guid: parsed.guid, timestamp: parsed.timestamp }); return text({ recoveredAt: data.recoverDoc }); };
  • Registration of the 'affine_recover_doc' tool, specifying title, description, input schema using Zod, and linking to the recoverDocHandler.
    server.registerTool( "affine_recover_doc", { title: "Recover Document", description: "Recover a doc to a previous timestamp.", inputSchema: { workspaceId: z.string().optional(), guid: z.string(), timestamp: z.string() } }, recoverDocHandler as any );
  • Input schema definition for the tool using Zod validators.
    workspaceId: z.string().optional(), guid: z.string(), timestamp: z.string() }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DAWNCR0W/affine-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server