get_project_categories
Retrieve available categories for a MantisBT project to properly classify issues when reporting bugs or feature requests.
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
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Numeric project ID |
Implementation Reference
- src/tools/projects.ts:121-156 (handler)The get_project_categories tool is registered and implemented within registerProjectTools in src/tools/projects.ts. It fetches project details from the MantisBT API, extracts the categories, and processes them to strip a specific prefix for global categories.
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 }; } } );