reset_unread_notification_count
Resets the count of unread notifications to zero, clearing the notification badge for the user's account.
Instructions
Reset unread notification count
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organization | No | Optional organization name. Use list_organizations to inspect available organizations. |
Implementation Reference
- Main handler implementation of the 'reset_unread_notification_count' tool. Defines the tool schema (no input params), registers the tool name/description, and the handler calls backlog.resetNotificationsMarkAsRead(). Output uses NotificationCountSchema.
import { z } from 'zod'; import { Backlog } from 'backlog-js'; import { buildToolSchema, ToolDefinition } from '../types/tool.js'; import { TranslationHelper } from '../createTranslationHelper.js'; import { NotificationCountSchema } from '../types/zod/backlogOutputDefinition.js'; const resetUnreadNotificationCountSchema = buildToolSchema((_t) => ({})); export const resetUnreadNotificationCountTool = ( backlog: Backlog, { t }: TranslationHelper ): ToolDefinition< ReturnType<typeof resetUnreadNotificationCountSchema>, (typeof NotificationCountSchema)['shape'] > => { return { name: 'reset_unread_notification_count', description: t( 'TOOL_RESET_UNREAD_NOTIFICATION_COUNT_DESCRIPTION', 'Reset unread notification count' ), schema: z.object(resetUnreadNotificationCountSchema(t)), outputSchema: NotificationCountSchema, handler: async () => backlog.resetNotificationsMarkAsRead(), }; }; - src/tools/tools.ts:48-48 (registration)Import of resetUnreadNotificationCountTool from its module file.
import { resetUnreadNotificationCountTool } from './resetUnreadNotificationCount.js'; - src/tools/tools.ts:172-172 (registration)Registration of resetUnreadNotificationCountTool in the 'notifications' toolset group.
resetUnreadNotificationCountTool(backlog, helper), - NotificationCountSchema definition used as the output schema for the tool: { count: z.number() }.
export const NotificationCountSchema = z.object({ count: z.number(), }); - src/types/tool.ts:5-26 (helper)ToolDefinition type and buildToolSchema helper used by the tool implementation.
export type ToolDefinition< Shape extends z.ZodRawShape, OutputShape extends z.ZodRawShape, > = { name: string; description: string; schema: z.ZodObject<Shape>; outputSchema: z.ZodObject<OutputShape>; handler: ( input: z.infer<z.ZodObject<Shape>> & { fields?: string; organization?: string; } ) => Promise< z.infer<z.ZodObject<OutputShape>> | z.infer<z.ZodObject<OutputShape>>[] >; importantFields?: (keyof z.infer<z.ZodObject<OutputShape>>)[]; }; export const buildToolSchema = <T extends z.ZodRawShape>( fn: (t: TranslationHelper['t']) => T ) => fn;