add_case_followers
Add multiple followers to a case to receive notifications and updates about case progress.
Instructions
Add multiple followers to a work object. Allows users to follow a case to receive notifications and updates about case progress.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| caseID | Yes | Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces."OSIEO3-DOCSAPP-WORK T-561003". a complete case identifier including spaces and special characters. | |
| users | Yes | Array of user objects to add as followers to the case. Each user object should contain user identification information. | |
| sessionCredentials | No | Optional session-specific credentials. If not provided, uses environment variables. Supports two authentication modes: (1) OAuth mode - provide baseUrl, clientId, and clientSecret, or (2) Token mode - provide baseUrl and accessToken. |
Implementation Reference
- Main tool handler class AddCaseFollowersTool extending BaseTool. Contains the execute() method (lines 51-95) that validates params (caseID, users) and calls pegaClient.addCaseFollowers().
import { BaseTool } from '../../registry/base-tool.js'; import { getSessionCredentialsSchema } from '../../utils/tool-schema.js'; export class AddCaseFollowersTool extends BaseTool { /** * Get the category this tool belongs to */ static getCategory() { return 'followers'; } /** * Get tool definition for MCP protocol */ static getDefinition() { return { name: 'add_case_followers', description: 'Add multiple followers to a work object. Allows users to follow a case to receive notifications and updates about case progress.', inputSchema: { type: 'object', properties: { caseID: { type: 'string', description: 'Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces."OSIEO3-DOCSAPP-WORK T-561003". a complete case identifier including spaces and special characters.' }, users: { type: 'array', description: 'Array of user objects to add as followers to the case. Each user object should contain user identification information.', items: { type: 'object', properties: { ID: { type: 'string', description: 'User identifier of the person to add as a follower. This is the unique identifier for the user in the Pega system.' } }, required: ['ID'] }, minItems: 1 }, sessionCredentials: getSessionCredentialsSchema() }, required: ['caseID', 'users'] } }; } /** * Execute the add case followers operation */ async execute(params) { const { caseID, users } = params; let sessionInfo = null; try { sessionInfo = this.initializeSessionConfig(params); // Validate required parameters using base class const requiredValidation = this.validateRequiredParams(params, ['caseID', 'users']); if (requiredValidation) { return requiredValidation; } // Validate users array if (!Array.isArray(users) || users.length === 0) { return { error: 'users parameter must be a non-empty array of user objects.' }; } // Validate each user object for (let i = 0; i < users.length; i++) { const user = users[i]; if (!user.ID) { return { error: `User at index ${i} is missing required ID field.` }; } } // Execute with standardized error handling return await this.executeWithErrorHandling( `Add Case Followers: ${caseID}`, async () => await this.pegaClient.addCaseFollowers(caseID.trim(), users), { sessionInfo } ); } catch (error) { return { content: [{ type: 'text', text: `## Error: Add Case Followers: ${caseID}\n\n**Unexpected Error**: ${error.message}\n\n${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*` }] }; } } - Input schema definition for add_case_followers tool. Defines required parameters: caseID (string), users (array of objects with required 'ID' field), and optional sessionCredentials.
static getDefinition() { return { name: 'add_case_followers', description: 'Add multiple followers to a work object. Allows users to follow a case to receive notifications and updates about case progress.', inputSchema: { type: 'object', properties: { caseID: { type: 'string', description: 'Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces."OSIEO3-DOCSAPP-WORK T-561003". a complete case identifier including spaces and special characters.' }, users: { type: 'array', description: 'Array of user objects to add as followers to the case. Each user object should contain user identification information.', items: { type: 'object', properties: { ID: { type: 'string', description: 'User identifier of the person to add as a follower. This is the unique identifier for the user in the Pega system.' } }, required: ['ID'] }, minItems: 1 }, sessionCredentials: getSessionCredentialsSchema() }, required: ['caseID', 'users'] } }; - src/registry/configurable-tool-loader.js:150-177 (registration)Tools are dynamically discovered and registered by scanning the tools/followers directory. The loadToolFile method (lines 150-207) imports the module, finds the tool class, validates it, checks config, and registers it in the loadedTools map with tool name 'add_case_followers'.
async loadToolFile(categoryPath, filename, category) { const filePath = resolve(categoryPath, filename); const fileUrl = pathToFileURL(filePath).href; try { const module = await import(fileUrl); // Find the tool class in the module const ToolClass = this.findToolClass(module); if (!ToolClass) { return { loaded: false, toolName: filename.replace('.js', ''), reason: 'No valid tool class found' }; } // Validate tool class const validationResult = this.validateToolClass(ToolClass, category, filename); if (!validationResult.valid) { return { loaded: false, toolName: filename.replace('.js', ''), reason: validationResult.reason }; } // Get tool name from definition - src/api/pega-client.js:751-763 (helper)PegaClient.addCaseFollowers() - API client helper method that delegates to the underlying client, with feature availability check for 'followers' (V2-only feature).
/** * Add case followers * V2 ONLY * @param {string} caseID - Case ID * @param {Array} users - Users array * @returns {Promise<Object>} Addition result */ async addCaseFollowers(caseID, users) { if (!this.isFeatureAvailable('followers')) { this.throwUnsupportedFeatureError('followers', 'addCaseFollowers'); } return this.client.addCaseFollowers(caseID, users); } - src/tools/followers/add-case-followers.js:15-45 (registration)Tool name 'add_case_followers' defined in getDefinition() static method (line 17), which is used by the configurable loader to register the tool.
static getDefinition() { return { name: 'add_case_followers', description: 'Add multiple followers to a work object. Allows users to follow a case to receive notifications and updates about case progress.', inputSchema: { type: 'object', properties: { caseID: { type: 'string', description: 'Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces."OSIEO3-DOCSAPP-WORK T-561003". a complete case identifier including spaces and special characters.' }, users: { type: 'array', description: 'Array of user objects to add as followers to the case. Each user object should contain user identification information.', items: { type: 'object', properties: { ID: { type: 'string', description: 'User identifier of the person to add as a follower. This is the unique identifier for the user in the Pega system.' } }, required: ['ID'] }, minItems: 1 }, sessionCredentials: getSessionCredentialsSchema() }, required: ['caseID', 'users'] } };