Skip to main content
Glama

affine_list_histories

Retrieve document history timestamps for a specific document in AFFiNE workspaces, enabling version tracking and audit trail management.

Instructions

List doc histories (timestamps) for a doc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
beforeNo
guidYes
takeNo
workspaceIdNo

Implementation Reference

  • The handler function that executes the tool logic: queries the GraphQL API for document histories in a workspace, given guid, optional take and before parameters.
    const listHistoriesHandler = async (parsed: { workspaceId?: string; guid: string; take?: number; before?: string }) => { const workspaceId = parsed.workspaceId || defaults.workspaceId || parsed.workspaceId; if (!workspaceId) throw new Error("workspaceId required (or set AFFINE_WORKSPACE_ID)"); const query = `query Histories($workspaceId:String!,$guid:String!,$take:Int,$before:DateTime){ workspace(id:$workspaceId){ histories(guid:$guid, take:$take, before:$before){ id timestamp workspaceId } } }`; const data = await gql.request<{ workspace: any }>(query, { workspaceId, guid: parsed.guid, take: parsed.take, before: parsed.before }); return text(data.workspace.histories); };
  • Registers the 'affine_list_histories' tool with the MCP server, providing title, description, input schema, and linking to the handler function.
    server.registerTool( "affine_list_histories", { title: "List Histories", description: "List doc histories (timestamps) for a doc.", inputSchema: { workspaceId: z.string().optional(), guid: z.string(), take: z.number().optional(), before: z.string().optional() } }, listHistoriesHandler as any );
  • Zod-based input schema defining parameters for the tool: optional workspaceId, required guid, optional take and before.
    inputSchema: { workspaceId: z.string().optional(), guid: z.string(), take: z.number().optional(), before: z.string().optional() }
  • src/index.ts:68-68 (registration)
    Top-level call to registerHistoryTools, which in turn registers the 'affine_list_histories' tool among others.
    registerHistoryTools(server, gql, { workspaceId: config.defaultWorkspaceId });

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