get_watching_list_count
Retrieve the count of items a user is watching in Backlog by providing their user ID.
Instructions
Returns count of watching items for a user
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | User ID | |
| organization | No | Optional organization name. Use list_organizations to inspect available organizations. |
Implementation Reference
- src/tools/getWatchingListCount.ts:13-30 (handler)The handler function for the get_watching_list_count tool. It takes a userId and calls backlog.getWatchingListCount(userId) to return the count of watching items for a user.
export const getWatchingListCountTool = ( backlog: Backlog, { t }: TranslationHelper ): ToolDefinition< ReturnType<typeof getWatchingListCountSchema>, (typeof WatchingListCountSchema)['shape'] > => { return { name: 'get_watching_list_count', description: t( 'TOOL_GET_WATCHING_LIST_COUNT_DESCRIPTION', 'Returns count of watching items for a user' ), schema: z.object(getWatchingListCountSchema(t)), outputSchema: WatchingListCountSchema, handler: async ({ userId }) => backlog.getWatchingListCount(userId), }; }; - Input schema defining userId (number) as the required input parameter.
const getWatchingListCountSchema = buildToolSchema((t) => ({ userId: z .number() .describe(t('TOOL_GET_WATCHING_LIST_COUNT_USER_ID', 'User ID')), })); - Output schema (WatchingListCountSchema) defining the response shape: { count: number }
export const WatchingListCountSchema = z.object({ count: z.number(), }); - src/tools/tools.ts:38-39 (registration)Import of the getWatchingListCountTool in the central tools registration file.
import { getWatchingListCountTool } from './getWatchingListCount.js'; import { getWatchingListItemsTool } from './getWatchingListItems.js'; - src/tools/tools.ts:114-114 (registration)Registration of getWatchingListCountTool in the 'issue' toolset within the allTools function.
getWatchingListCountTool(backlog, helper),