Get Project Categories
get_project_categoriesRetrieve and clean category names for a MantisBT project to use when creating issues. Strips global prefixes for direct application.
Instructions
List all categories available for a MantisBT project.
Note: The MantisBT API returns global (cross-project) categories with a "[All Projects] " prefix. This tool strips that prefix so the returned names can be used directly when creating issues.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Numeric project ID |
Implementation Reference
- src/tools/projects.ts:126-161 (handler)Implementation and registration of the 'get_project_categories' tool. It fetches project categories, strips the '[All Projects] ' prefix from global categories, and returns the list.
server.registerTool( 'get_project_categories', { title: 'Get Project Categories', description: `List all categories available for a MantisBT project. Note: The MantisBT API returns global (cross-project) categories with a "[All Projects] " prefix. This tool strips that prefix so the returned names can be used directly when creating issues.`, inputSchema: z.object({ project_id: z.coerce.number().int().positive().describe('Numeric project ID'), }), annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, }, }, async ({ project_id }) => { try { const result = await client.get<{ projects: Array<{ categories?: MantisCategory[] }> }>(`projects/${project_id}`); const raw = result.projects?.[0]?.categories ?? []; const categories = raw.map((cat) => ({ ...cat, name: cat.name.startsWith(ALL_PROJECTS_PREFIX) ? cat.name.slice(ALL_PROJECTS_PREFIX.length) : cat.name, })); return { content: [{ type: 'text', text: JSON.stringify(categories, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } );