Skip to main content
Glama

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
NameRequiredDescriptionDefault
project_idYesNumeric project ID

Implementation Reference

  • 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 };
          }
        }
      );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dpesch/mantisbt-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server