get_case_view
Retrieve view details and metadata for a specific case using its ID and view name, with customizable logic from pyUpgradeOnOpen Data Transform.
Instructions
Get view details based on case ID and view name. Returns view metadata with customizable logic from pyUpgradeOnOpen Data Transform.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| caseID | Yes | Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces. | |
| viewID | Yes | Name of the view to retrieve | |
| 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
- src/tools/cases/get-case-view.js:40-68 (handler)The execute method implements the core logic of the get_case_view tool: parameter validation, session initialization, API call to pegaClient.getCaseView, error handling, and response formatting.async execute(params) { const { caseID, viewID } = 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', 'viewID']); if (requiredValidation) { return requiredValidation; } // Execute with standardized error handling return await this.executeWithErrorHandling( `Case View Details: ${viewID} for ${caseID}`, async () => await this.pegaClient.getCaseView(caseID.trim(), viewID.trim()), { caseID, viewID, sessionInfo } ); } catch (error) { return { content: [{ type: 'text', text: `## Error: Get Case View\n\n**Unexpected Error**: ${error.message}\n\n${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*` }] }; } }
- The getDefinition static method defines the tool name, description, and input schema for validation.static getDefinition() { return { name: 'get_case_view', description: 'Get view details based on case ID and view name. Returns view metadata with customizable logic from pyUpgradeOnOpen Data Transform.', inputSchema: { type: 'object', properties: { caseID: { type: 'string', description: 'Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces.' }, viewID: { type: 'string', description: 'Name of the view to retrieve' }, sessionCredentials: getSessionCredentialsSchema() }, required: ['caseID', 'viewID'] } }; }
- Custom formatSuccessResponse method provides tailored markdown output including case info, UI resources summary, and session details.formatSuccessResponse(operation, data, options = {}) { const { caseID, viewID, sessionInfo } = options; let response = `## ${operation}\n\n`; response += `*Operation completed at: ${new Date().toISOString()}*\n\n`; // Session Information (if applicable) if (sessionInfo) { response += `### Session Information\n`; response += `- **Session ID**: ${sessionInfo.sessionId}\n`; response += `- **Authentication Mode**: ${sessionInfo.authMode.toUpperCase()}\n`; response += `- **Configuration Source**: ${sessionInfo.configSource}\n\n`; } // Display case data if available if (data.data) { response += '### Case Data\n'; // Handle case info if (data.data.caseInfo) { const caseInfo = data.data.caseInfo; response += `- **Case Type**: ${caseInfo.caseTypeName || 'N/A'}\n`; response += `- **Status**: ${caseInfo.status || 'N/A'}\n`; response += `- **Stage**: ${caseInfo.stage || 'N/A'}\n`; response += `- **Step**: ${caseInfo.step || 'N/A'}\n`; response += `- **Urgency**: ${caseInfo.urgency || 'N/A'}\n`; response += `- **Last Updated**: ${caseInfo.lastUpdateTime || 'N/A'}\n`; // Display content if available if (caseInfo.content && Object.keys(caseInfo.content).length > 0) { response += '\n#### Case Content\n'; for (const [key, value] of Object.entries(caseInfo.content)) { if (value !== null && value !== undefined) { response += `- **${key}**: ${value}\n`; } } } } // Display any other data properties const otherDataKeys = Object.keys(data.data).filter(key => key !== 'caseInfo'); if (otherDataKeys.length > 0) { response += '\n#### Additional Data\n'; otherDataKeys.forEach(key => { const value = data.data[key]; if (value !== null && value !== undefined) { if (typeof value === 'object') { response += `- **${key}**: ${JSON.stringify(value, null, 2)}\n`; } else { response += `- **${key}**: ${value}\n`; } } }); } } // Display UI resources if available if (data.uiResources) { response += '\n### UI Resources\n'; response += '- View metadata loaded successfully\n'; if (data.uiResources.root) { response += `- **Root Component Type**: ${data.uiResources.root.type || 'Unknown'}\n`; if (data.uiResources.root.config) { response += '- **Component Configuration**: Available\n'; } if (data.uiResources.root.children && data.uiResources.root.children.length > 0) { response += `- **Child Components**: ${data.uiResources.root.children.length} components\n`; } } // Display view configuration if available if (data.uiResources.config) { response += '- **View Configuration**: Available\n'; } // Display resources summary const resourceKeys = Object.keys(data.uiResources).filter(key => key !== 'root' && key !== 'config'); if (resourceKeys.length > 0) { response += `- **Additional Resources**: ${resourceKeys.join(', ')}\n`; } } response += '\n### Processing Details\n'; response += '- **Data Transform**: pyUpgradeOnOpen executed successfully\n'; response += '- **View Type**: Read-only view (or form if used in modal pop-up)\n'; return response; }
- src/api/pega-client.js:209-211 (helper)PegaClient.getCaseView method proxies the request to the appropriate version-specific client (v1 or v2). This is the direct API call used by the tool.async getCaseView(caseID, viewID) { return this.client.getCaseView(caseID, viewID); }