count_notifications
Count notifications in Backlog, with options to filter by read status and organization.
Instructions
Returns count of notifications
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alreadyRead | Yes | Whether to include already read notifications | |
| resourceAlreadyRead | Yes | Whether to include notifications for already read resources | |
| organization | No | Optional organization name. Use list_organizations to inspect available organizations. |
Implementation Reference
- src/tools/getNotificationsCount.ts:26-41 (handler)The tool function that returns the 'count_notifications' tool definition including its handler (which calls backlog.getNotificationsCount(params)).
export const getNotificationsCountTool = ( backlog: Backlog, { t }: TranslationHelper ): ToolDefinition< ReturnType<typeof getNotificationsCountSchema>, (typeof NotificationCountSchema)['shape'] > => { return { name: 'count_notifications', description: t( 'TOOL_COUNT_NOTIFICATIONS_DESCRIPTION', 'Returns count of notifications' ), schema: z.object(getNotificationsCountSchema(t)), outputSchema: NotificationCountSchema, handler: async (params) => backlog.getNotificationsCount(params), - Input schema definition for count_notifications: accepts 'alreadyRead' and 'resourceAlreadyRead' boolean params.
const getNotificationsCountSchema = buildToolSchema((t) => ({ alreadyRead: z .boolean() .describe( t( 'TOOL_GET_NOTIFICATIONS_COUNT_ALREADY_READ', 'Whether to include already read notifications' ) ), resourceAlreadyRead: z .boolean() .describe( t( 'TOOL_GET_NOTIFICATIONS_COUNT_RESOURCE_ALREADY_READ', 'Whether to include notifications for already read resources' ) ), })); - Output schema (NotificationCountSchema) for count_notifications: returns an object with a 'count' number field.
export const NotificationCountSchema = z.object({ count: z.number(), }); - src/tools/tools.ts:165-174 (registration)Registration of the count_notifications tool within the 'notifications' toolset. The tool is registered via getNotificationsCountTool(backlog, helper) on line 171.
{ name: 'notifications', description: 'Tools for managing user notifications.', enabled: false, tools: [ getNotificationsTool(backlog, helper), getNotificationsCountTool(backlog, helper), resetUnreadNotificationCountTool(backlog, helper), markNotificationAsReadTool(backlog, helper), ], - src/types/tool.ts:24-27 (helper)The buildToolSchema helper used to construct the input schema for count_notifications.
export const buildToolSchema = <T extends z.ZodRawShape>( fn: (t: TranslationHelper['t']) => T ) => fn;