Skip to main content
Glama

list_issue_files

Retrieve all file attachments associated with a specific MantisBT issue to access documentation, screenshots, or related files.

Instructions

List all file attachments of a MantisBT issue.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issue_idYesNumeric issue ID

Implementation Reference

  • The handler function for 'list_issue_files' which fetches attachments for a given issue ID from the MantisClient and returns them as a JSON-formatted text content.
    async ({ issue_id }) => {
      try {
        const result = await client.get<{ issues: Array<{ attachments?: MantisFile[] }> }>(`issues/${issue_id}`);
        const attachments = result.issues?.[0]?.attachments ?? [];
        return {
          content: [{ type: 'text', text: JSON.stringify(attachments, null, 2) }],
        };
      } catch (error) {
        const msg = error instanceof Error ? error.message : String(error);
        return { content: [{ type: 'text', text: errorText(msg) }], isError: true };
      }
    }
  • The registration of the 'list_issue_files' tool, including its schema definition and invocation of the handler.
    server.registerTool(
      'list_issue_files',
      {
        title: 'List Issue File Attachments',
        description: 'List all file attachments of a MantisBT issue.',
        inputSchema: z.object({
          issue_id: z.coerce.number().int().positive().describe('Numeric issue ID'),
        }),
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
        },
      },
      async ({ issue_id }) => {
        try {
          const result = await client.get<{ issues: Array<{ attachments?: MantisFile[] }> }>(`issues/${issue_id}`);
          const attachments = result.issues?.[0]?.attachments ?? [];
          return {
            content: [{ type: 'text', text: JSON.stringify(attachments, null, 2) }],
          };
        } catch (error) {
          const msg = error instanceof Error ? error.message : String(error);
          return { content: [{ type: 'text', text: errorText(msg) }], isError: true };
        }
      }
    );
  • The input schema definition for 'list_issue_files', requiring a numeric 'issue_id'.
    inputSchema: z.object({
      issue_id: z.coerce.number().int().positive().describe('Numeric issue ID'),
    }),

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