Skip to main content
Glama

affine_generate_access_token

Generate a personal access token for secure authentication and interaction with AFFiNE workspaces via GraphQL API, enabling document management and workspace operations.

Instructions

Generate a personal access token (returns token).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expiresAtNo
nameYes

Implementation Reference

  • The asynchronous handler function that executes the tool logic by sending a GraphQL mutation to generate a new personal access token.
    const generateAccessTokenHandler = async (parsed: { name: string; expiresAt?: string }) => { const mutation = `mutation($input: GenerateAccessTokenInput!){ generateUserAccessToken(input:$input){ id name createdAt expiresAt token } }`; const data = await gql.request<{ generateUserAccessToken: any }>(mutation, { input: { name: parsed.name, expiresAt: parsed.expiresAt ?? null } }); return text(data.generateUserAccessToken); };
  • Registers the 'affine_generate_access_token' tool with the MCP server, providing title, description, input schema using Zod, and references the handler function.
    server.registerTool( "affine_generate_access_token", { title: "Generate Access Token", description: "Generate a personal access token (returns token).", inputSchema: { name: z.string(), expiresAt: z.string().optional() } }, generateAccessTokenHandler as any );
  • src/index.ts:72-72 (registration)
    Top-level call to registerAccessTokenTools, which includes the registration of 'affine_generate_access_token' among other access token tools.
    registerAccessTokenTools(server, gql);
  • Zod-based input schema for the tool: requires 'name' string, optional 'expiresAt' string.
    name: z.string(), expiresAt: z.string().optional() }

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