Skip to main content
Glama

create_issue

Create new bug reports or feature requests in MantisBT by providing summary, project details, and categorization. Submit issues with priority, severity, and assignment options for tracking.

Instructions

Create a new MantisBT issue. Returns the created issue including its assigned ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
summaryYesIssue summary/title
descriptionNoDetailed issue description
project_idYesProject ID the issue belongs to
categoryYesCategory name (use get_project_categories to list available categories)
priorityNoPriority name (e.g. "normal", "high", "urgent", "immediate", "low", "none")
severityNoSeverity name (e.g. "minor", "major", "crash", "block", "feature", "trivial", "text") — default: "minor"minor
handler_idNoUser ID of the person to assign the issue to
handlerNoUsername (login name) of the person to assign the issue to. Alternative to handler_id — the server resolves the name to a user ID from the project members. Use get_project_users to see available users.

Implementation Reference

  • The handler implementation for the `create_issue` tool, which manages issue creation and handler ID resolution.
      async ({ summary, description, project_id, category, priority, severity, handler_id, handler }) => {
        // Resolve handler username to handler_id when only a name is given
        let resolvedHandlerId = handler_id;
        if (resolvedHandlerId === undefined && handler !== undefined) {
          const metadata = await cache.loadIfValid();
          let users: MantisUser[] = metadata?.byProject[project_id]?.users ?? [];
          if (users.length === 0) {
            try {
              const usersResult = await client.get<{ users: MantisUser[] }>(`projects/${project_id}/users`);
              users = usersResult.users ?? [];
            } catch {
              users = [];
            }
          }
          const user = users.find(u => u.name === handler || u.real_name === handler);
          if (!user) {
            const names = users.map(u => u.name).join(', ');
            return {
              content: [{ type: 'text', text: errorText(`User "${handler}" not found in project ${project_id}. Available users: ${names || 'none (run sync_metadata or check project_id)'}`) }],
              isError: true,
            };
          }
          resolvedHandlerId = user.id;
        }
    
        try {
          const body: Record<string, unknown> = {
            summary,
            description,
            project: { id: project_id },
            category: { name: category },
          };
          if (priority) body.priority = { name: priority };
          body.severity = { name: severity };
          if (resolvedHandlerId) body.handler = { id: resolvedHandlerId };
    
          const raw = await client.post<Record<string, unknown>>('issues', body);
          const partial = ('issue' in raw && typeof raw['issue'] === 'object' && raw['issue'] !== null)
            ? raw['issue'] as MantisIssue
            : raw as unknown as MantisIssue;
          let issue: MantisIssue = partial;
          if (!('summary' in (partial as unknown as Record<string, unknown>))) {
            // Older MantisBT returned only { id: N } — fetch the full issue.
            // Suppress GET errors: the issue was already created.
            try {
              const fetched = await client.get<{ issues: MantisIssue[] }>(`issues/${partial.id}`);
              issue = fetched.issues?.[0] ?? partial;
            } catch {
              // unable to fetch details — return minimal object
            }
          }
          return {
            content: [{ type: 'text', text: JSON.stringify(issue, null, 2) }],
          };
        } catch (error) {
          const msg = error instanceof Error ? error.message : String(error);
          return { content: [{ type: 'text', text: errorText(msg) }], isError: true };
        }
      }
    );
  • Registration of the `create_issue` tool with its schema definition and tool configuration.
    server.registerTool(
      'create_issue',
      {
        title: 'Create Issue',
        description: 'Create a new MantisBT issue. Returns the created issue including its assigned ID.',
        inputSchema: z.object({
          summary: z.string().min(1).describe('Issue summary/title'),
          description: z.string().default('').describe('Detailed issue description'),
          project_id: z.coerce.number().int().positive().describe('Project ID the issue belongs to'),
          category: z.string().min(1).describe('Category name (use get_project_categories to list available categories)'),
          priority: z.string().optional().describe('Priority name (e.g. "normal", "high", "urgent", "immediate", "low", "none")'),
          severity: z.string().default('minor').describe('Severity name (e.g. "minor", "major", "crash", "block", "feature", "trivial", "text") — default: "minor"'),
          handler_id: z.coerce.number().int().positive().optional().describe('User ID of the person to assign the issue to'),
          handler: z.string().optional().describe('Username (login name) of the person to assign the issue to. Alternative to handler_id — the server resolves the name to a user ID from the project members. Use get_project_users to see available users.'),
        }),
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
          idempotentHint: false,
        },
      },

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