Skip to main content
Glama

Generate Access Token

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()
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Generate') and outcome ('returns token'), but lacks critical details: it doesn't specify if this requires authentication, what permissions the token grants, whether it's revocable, or any rate limits. For a security-sensitive tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise—a single sentence with no wasted words. It front-loads the key action and result, making it easy to parse. Every part earns its place by stating the tool's core function efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of token generation (a security-sensitive operation), lack of annotations, no output schema, and undocumented parameters, the description is incomplete. It doesn't cover authentication requirements, token usage, error conditions, or return format, which are essential for safe and effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 2 parameters with 0% description coverage, and the description provides no information about them. It doesn't explain what 'name' and 'expiresAt' represent (e.g., token identifier and expiration date), their formats, or default behaviors. With low schema coverage, the description fails to compensate, leaving parameters undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Generate') and resource ('personal access token'), and specifies the return value ('returns token'). It distinguishes from sibling tools like 'affine_list_access_tokens' and 'affine_revoke_access_token' by focusing on creation rather than listing or revocation. However, it doesn't specify the scope or permissions of the generated token, which could make it slightly less specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., authentication state), when not to use it (e.g., if a token already exists), or compare it to related tools like 'affine_sign_in' for authentication. This leaves the agent without context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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