Skip to main content
Glama

affine_list_notifications

Fetch user notifications from AFFiNE workspaces, allowing users to specify the number of notifications and filter for unread ones only.

Instructions

Get user notifications.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNoNumber of notifications to fetch
unreadOnlyNoShow only unread notifications

Implementation Reference

  • Async handler function that executes the tool logic: fetches notifications via GraphQL query to currentUser.notifications, optionally filters to unread only, and returns the list or error message.
    const listNotificationsHandler = async ({ first = 20, unreadOnly = false }: { first?: number; unreadOnly?: boolean }) => { try { const query = ` query GetNotifications($first: Int!) { currentUser { notifications(first: $first) { nodes { id type title body read createdAt } totalCount pageInfo { hasNextPage } } } } `; const data = await gql.request<{ currentUser: { notifications: any } }>(query, { first }); let notifications = data.currentUser?.notifications?.nodes || []; if (unreadOnly) { notifications = notifications.filter((n: any) => !n.read); } return text(notifications); } catch (error: any) { return text({ error: error.message }); } };
  • Registration of the 'affine_list_notifications' tool on the MCP server, including title, description, input schema with Zod validators, and reference to the handler function.
    server.registerTool( "affine_list_notifications", { title: "List Notifications", description: "Get user notifications.", inputSchema: { first: z.number().optional().describe("Number of notifications to fetch"), unreadOnly: z.boolean().optional().describe("Show only unread notifications") } }, listNotificationsHandler as any );
  • Input schema definition using Zod for optional parameters 'first' (number) and 'unreadOnly' (boolean).
    inputSchema: { first: z.number().optional().describe("Number of notifications to fetch"), unreadOnly: z.boolean().optional().describe("Show only unread notifications") }
  • Related registration of alias 'list_notifications' using the same handler and schema.
    server.registerTool( "list_notifications", { title: "List Notifications", description: "Get user notifications.", inputSchema: { first: z.number().optional().describe("Number of notifications to fetch"), unreadOnly: z.boolean().optional().describe("Show only unread notifications") } }, listNotificationsHandler as any );

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