get_wikis_count
Retrieves the total count of wiki pages in a Backlog project by providing the project ID or key.
Instructions
Returns count of wiki pages in a project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | The numeric ID of the project (e.g., 12345) | |
| projectKey | No | The key of the project (e.g., 'PROJECT') | |
| organization | No | Optional organization name. Use list_organizations to inspect available organizations. |
Implementation Reference
- src/tools/getWikisCount.ts:29-56 (handler)The main handler function 'getWikisCountTool' defining the tool. It accepts a backlog client and translation helper, returns a ToolDefinition with name 'get_wikis_count'. The handler resolves project ID or key via resolveIdOrKey and calls backlog.getWikisCount().
export const getWikisCountTool = ( backlog: Backlog, { t }: TranslationHelper ): ToolDefinition< ReturnType<typeof getWikisCountSchema>, (typeof WikiCountSchema)['shape'] > => { return { name: 'get_wikis_count', description: t( 'TOOL_GET_WIKIS_COUNT_DESCRIPTION', 'Returns count of wiki pages in a project' ), schema: z.object(getWikisCountSchema(t)), outputSchema: WikiCountSchema, handler: async ({ projectId, projectKey }) => { const result = resolveIdOrKey( 'project', { id: projectId, key: projectKey }, t ); if (!result.ok) { throw result.error; } return backlog.getWikisCount(result.value); }, }; }; - src/tools/getWikisCount.ts:8-27 (schema)Input schema 'getWikisCountSchema' defining optional 'projectId' (number) and 'projectKey' (string) parameters.
const getWikisCountSchema = buildToolSchema((t) => ({ projectId: z .number() .optional() .describe( t( 'TOOL_GET_WIKIS_COUNT_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)' ) ), projectKey: z .string() .optional() .describe( t( 'TOOL_GET_WIKIS_COUNT_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')" ) ), })); - Output schema 'WikiCountSchema' — a Zod object with a single 'count' field of type number, used as the output validation for the tool.
export const WikiCountSchema = z.object({ count: z.number(), }); - src/tools/tools.ts:131-131 (registration)Registration of the tool within the 'wiki' toolset group. It is instantiated as getWikisCountTool(backlog, helper) and placed in the wiki tools array (line 131). Also imported at line 46.
getWikisCountTool(backlog, helper), - src/utils/resolveIdOrKey.ts:51-55 (helper)Helper function 'resolveIdOrKey' used by the handler to resolve a project from either its numeric ID or string key, returning a Result type.
export const resolveIdOrKey = <E extends EntityName>( entity: E, values: { id?: number; key?: string }, t: TranslationHelper['t'] ): ResolveResult => resolveIdOrField(entity, 'key', values, t);