Add Issue Monitor
add_monitorAdd a user as a watcher to receive email notifications for MantisBT issue updates.
Instructions
Add a user as a monitor (watcher) of a MantisBT issue. Monitors receive email notifications for issue updates.
Input 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:19-46 (handler)The handler implementation for the 'add_monitor' tool using the MantisClient to perform a POST request to add a monitor.
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 }; } } ); - src/tools/monitors.ts:24-27 (schema)The Zod schema validation for the input parameters of the 'add_monitor' tool.
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:13-13 (registration)The registration function where 'add_monitor' is registered as a tool on the McpServer.
export function registerMonitorTools(server: McpServer, client: MantisClient): void {