Skip to main content
Glama

List Issue File Attachments

list_issue_files
Read-onlyIdempotent

Retrieve all file attachments for a given MantisBT issue, including filename, size, content type, and download URL.

Instructions

List all file attachments of a MantisBT issue. Returns an array of attachment objects, each containing id, filename, size in bytes, content_type, and download_url. Returns an empty array if the issue has no attachments.

Use this tool when you need to inspect or enumerate files attached to an issue. To add a new attachment, use upload_file instead. To retrieve full issue details that include attachments alongside other fields, use get_issue instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issue_idYesNumeric issue ID

Implementation Reference

  • The async handler function that executes the 'list_issue_files' tool logic. It calls the MantisClient API to fetch issue data and extracts the attachments array, returning it as JSON text.
    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 tool registration metadata: title, description, inputSchema (issue_id: positive integer), and annotations (readOnlyHint, destructiveHint, idempotentHint).
      server.registerTool(
        'list_issue_files',
        {
          title: 'List Issue File Attachments',
          description: `List all file attachments of a MantisBT issue. Returns an array of attachment objects, each containing id, filename, size in bytes, content_type, and download_url. Returns an empty array if the issue has no attachments.
    
    Use this tool when you need to inspect or enumerate files attached to an issue. To add a new attachment, use upload_file instead. To retrieve full issue details that include attachments alongside other fields, use get_issue instead.`,
          inputSchema: z.object({
            issue_id: z.coerce.number().int().positive().describe('Numeric issue ID'),
          }),
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
          },
        },
  • The 'registerFileTools' function which calls server.registerTool('list_issue_files', ...) to register the tool with the MCP server.
    export function registerFileTools(server: McpServer, client: MantisClient, uploadDir?: string): void {
      const normalizedUploadDir = uploadDir ? resolve(uploadDir) + sep : undefined;
    
      // ---------------------------------------------------------------------------
      // list_issue_files
      // ---------------------------------------------------------------------------
    
      server.registerTool(
        'list_issue_files',
        {
          title: 'List Issue File Attachments',
          description: `List all file attachments of a MantisBT issue. Returns an array of attachment objects, each containing id, filename, size in bytes, content_type, and download_url. Returns an empty array if the issue has no attachments.
    
    Use this tool when you need to inspect or enumerate files attached to an issue. To add a new attachment, use upload_file instead. To retrieve full issue details that include attachments alongside other fields, use get_issue instead.`,
          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 MantisFile interface defining the shape of attachment objects returned by the tool (id, file_name, size, content_type, date_added, description).
    export interface MantisFile {
      id: number;
      file_name: string;
      size: number;
      content_type?: string;
      date_added?: string;
      description?: string;
    }
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate read-only, non-destructive, idempotent. Description adds return format details and edge case (empty array). Complements annotations without contradiction.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences: core function+return, usage guidance, alternatives. Front-loaded, no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, return structure, edge case, usage context, and alternatives. Sufficient for a simple list tool with good schema and annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a clear description for issue_id. Description adds no additional semantics, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it lists all file attachments of a MantisBT issue, specifies the return structure (array with id, filename, size, content_type, download_url), and distinguishes from sibling tools like upload_file and get_issue.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use: 'when you need to inspect or enumerate files attached to an issue.' Provides alternatives: use upload_file for adding, get_issue for full details including attachments.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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