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
| Name | Required | Description | Default |
|---|---|---|---|
| issue_id | Yes | Numeric issue ID |
Implementation Reference
- src/tools/files.ts:37-48 (handler)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 }; } } - src/tools/files.ts:23-49 (registration)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 }; } } ); - src/tools/files.ts:28-30 (schema)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'), }),