add_monitor
Add a user as a monitor to receive email notifications for MantisBT issue updates, ensuring they stay informed about changes.
Instructions
Add a user as a monitor (watcher) of a MantisBT issue. Monitors receive email notifications for issue updates.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issue_id | Yes | Numeric issue ID | |
| username | Yes | Username of the user to add as monitor |
Implementation Reference
- src/tools/monitors.ts:34-45 (handler)The handler implementation for the 'add_monitor' tool.
async ({ issue_id, username }) => { try { const body = { name: username }; const result = await client.post<unknown>(`issues/${issue_id}/monitors`, body); return { content: [{ type: 'text', text: JSON.stringify(result ?? { success: true }, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } - src/tools/monitors.ts:24-27 (schema)The input schema for the 'add_monitor' tool using Zod.
inputSchema: z.object({ issue_id: z.coerce.number().int().positive().describe('Numeric issue ID'), username: z.string().min(1).describe('Username of the user to add as monitor'), }), - src/tools/monitors.ts:19-46 (registration)Registration of the 'add_monitor' tool within the MCP server.
server.registerTool( 'add_monitor', { title: 'Add Issue Monitor', description: 'Add a user as a monitor (watcher) of a MantisBT issue. Monitors receive email notifications for issue updates.', inputSchema: z.object({ issue_id: z.coerce.number().int().positive().describe('Numeric issue ID'), username: z.string().min(1).describe('Username of the user to add as monitor'), }), annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, }, }, async ({ issue_id, username }) => { try { const body = { name: username }; const result = await client.post<unknown>(`issues/${issue_id}/monitors`, body); return { content: [{ type: 'text', text: JSON.stringify(result ?? { success: true }, null, 2) }], }; } catch (error) { const msg = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: errorText(msg) }], isError: true }; } } );