List Issue Notes
list_notesFetch all comments on a MantisBT issue without retrieving the entire issue.
Instructions
List all notes (comments) attached to a MantisBT issue. Note: get_issue already includes notes in its response — use list_notes only when you need notes without fetching the full issue.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issue_id | Yes | Numeric issue ID |
Implementation Reference
- src/tools/notes.ts:34-52 (handler)The async handler function that executes the 'list_notes' tool logic: calls client.get('issues/{issue_id}') to fetch the issue, extracts notes from the response, maps them with view URLs, and returns JSON text.
async ({ issue_id }) => { try { const [result, baseUrl] = await Promise.all([ client.get<{ issues: Array<{ notes?: MantisNote[] }> }>(`issues/${issue_id}`), client.getBaseUrl(), ]); const notes = (result.issues?.[0]?.notes ?? []).map(note => ({ ...note, view_url: buildNoteViewUrl(baseUrl, issue_id, note.id), })); return { content: [{ type: 'text', text: JSON.stringify(notes, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } ); - src/tools/notes.ts:20-33 (schema)Tool registration with Zod input schema (issue_id: number), description, title, and annotations (readOnlyHint, destructiveHint, idempotentHint).
server.registerTool( 'list_notes', { title: 'List Issue Notes', description: 'List all notes (comments) attached to a MantisBT issue. Note: get_issue already includes notes in its response — use list_notes only when you need notes without fetching the full issue.', inputSchema: z.object({ issue_id: z.coerce.number().int().positive().describe('Numeric issue ID'), }), annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, }, }, - src/index.ts:16-16 (registration)Import of registerNoteTools from ./tools/notes.js.
import { registerNoteTools } from './tools/notes.js'; - src/index.ts:68-68 (registration)Call to registerNoteTools(server, client) that triggers registration of all note-related tools including list_notes.
registerNoteTools(server, client); - src/client.ts:19-21 (helper)buildNoteViewUrl helper function used by the list_notes handler to generate view URLs linking to notes in the MantisBT web UI.
export function buildNoteViewUrl(baseUrl: string, issueId: number, noteId: number): string { return `${baseUrl}/view.php?id=${issueId}#bugnote${noteId}`; }