get_case_ancestors
Retrieve the parent-child hierarchy chain for a specific case to understand its lineage and relationships within the Pega platform.
Instructions
Get ancestor case hierarchy for a specific case. Retrieves ancestor hierarchy case list for the case ID passed in, showing the parent-child relationships up the case hierarchy chain. Each ancestor includes basic case information (ID, name) and HATEOAS navigation links.
Input Schema
TableJSON 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. The case must exist and be accessible to the current user. | |
| 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
- The execute method implements the core tool logic: parameter validation, session initialization, and delegation to PegaClient.getCaseAncestors via standardized error handling.async execute(params) { const { caseID } = params; let sessionInfo = null; try { // Initialize session configuration if provided sessionInfo = this.initializeSessionConfig(params); // Validate required parameters using base class const requiredValidation = this.validateRequiredParams(params, ['caseID']); if (requiredValidation) { return requiredValidation; } // Execute with standardized error handling return await this.executeWithErrorHandling( `Case Ancestors: ${caseID}`, async () => await this.pegaClient.getCaseAncestors(caseID.trim()), { caseID, sessionInfo } ); } catch (error) { return { content: [{ type: 'text', text: `## Error: Get Case Ancestors\n\n**Unexpected Error**: ${error.message}\n\n${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*` }] }; } }
- Defines the MCP tool metadata: name 'get_case_ancestors', description, and input schema requiring 'caseID' with optional sessionCredentials.static getDefinition() { return { name: 'get_case_ancestors', description: 'Get ancestor case hierarchy for a specific case. Retrieves ancestor hierarchy case list for the case ID passed in, showing the parent-child relationships up the case hierarchy chain. Each ancestor includes basic case information (ID, name) and HATEOAS navigation links.', 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. The case must exist and be accessible to the current user.' }, sessionCredentials: getSessionCredentialsSchema() }, required: ['caseID'] } }; }
- src/api/pega-client.js:231-238 (helper)PegaClient proxy method for getCaseAncestors, routing to v1 or v2 specific implementation based on configuration./** * Get case ancestors * @param {string} caseID - Case ID * @returns {Promise<Object>} Ancestor cases */ async getCaseAncestors(caseID) { return this.client.getCaseAncestors(caseID); }
- src/registry/tool-loader.js:123-134 (registration)Dynamic registration code in tool loader that instantiates the tool class and registers it by name from getDefinition() during directory scan of src/tools/cases.const toolInstance = new ToolClass(); const toolName = ToolClass.getDefinition().name; this.loadedTools.set(toolName, { instance: toolInstance, class: ToolClass, category: category, filename: filename }); return toolInstance; } catch (error) {