get_categories
Retrieves all categories associated with a specific project in Backlog. Provide project ID or key to get the category list.
Instructions
Returns list of categories for a project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | The numeric ID of the project (e.g., 12345) | |
| projectKey | No | The numeric ID of the project (e.g., 12345) | |
| organization | No | Optional organization name. Use list_organizations to inspect available organizations. |
Implementation Reference
- src/tools/getCategories.ts:29-56 (handler)The main handler function for the get_categories tool. It accepts projectId or projectKey, resolves the project identifier using resolveIdOrKey, and calls backlog.getCategories() to return the list of categories.
export const getCategoriesTool = ( backlog: Backlog, { t }: TranslationHelper ): ToolDefinition< ReturnType<typeof getCategoriesSchema>, (typeof CategorySchema)['shape'] > => { return { name: 'get_categories', description: t( 'TOOL_GET_CATEGORIES_DESCRIPTION', 'Returns list of categories for a project' ), schema: z.object(getCategoriesSchema(t)), importantFields: ['id', 'projectId', 'name'], outputSchema: CategorySchema, handler: async ({ projectId, projectKey }) => { const result = resolveIdOrKey( 'project', { id: projectId, key: projectKey }, t ); if (!result.ok) { throw result.error; } return backlog.getCategories(result.value); }, }; - src/tools/getCategories.ts:8-27 (schema)Input schema for get_categories, defining optional projectId (number) and projectKey (string) fields using buildToolSchema.
const getCategoriesSchema = buildToolSchema((t) => ({ projectId: z .number() .optional() .describe( t( 'TOOL_GET_CATEGORIES_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)' ) ), projectKey: z .string() .optional() .describe( t( 'TOOL_GET_CATEGORIES_PROJECT_ID', "The key of the project (e.g., 'PROJECT')" ) ), })); - Output schema (CategorySchema) for categories returned by the tool, defining fields: id, projectId, name, displayOrder.
export const CategorySchema = z.object({ id: z.number(), projectId: z.number(), name: z.string(), displayOrder: z.number(), }); - src/tools/tools.ts:14-14 (registration)Import of getCategoriesTool from getCategories.ts for registration in the toolset.
import { getCategoriesTool } from './getCategories.js'; - src/tools/tools.ts:109-109 (registration)Registration of getCategoriesTool in the 'issue' toolset group within allTools.
getCategoriesTool(backlog, helper),