get_case_type_action
Retrieve metadata and available actions for a specific case type action in Pega DX to understand how to interact with case workflows.
Instructions
Get detailed information about a case action, including view metadata and available actions
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| caseTypeID | Yes | ID of the case type for which the case action metadata is being retrieved, for example: Bug | |
| actionID | Yes | Action ID for case type action (Example: "pyUpdateCaseDetails", "pyApproval"). CRITICAL: Action IDs are CASE-SENSITIVE and have no spaces even if display names do ("Edit details" → "pyUpdateCaseDetails"). Use get_case_types to discover available case types and their supported actions. | |
| 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 primary handler function that implements the get_case_type_action tool logic. Validates inputs, handles sessions, calls the Pega API via pegaClient, and provides standardized error handling.
async execute(params) { const { caseTypeID, actionID } = 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, ['caseTypeID', 'actionID']); if (requiredValidation) { return requiredValidation; } // Execute with standardized error handling return await this.executeWithErrorHandling( `Case Type Action Metadata: ${caseTypeID} - ${actionID}`, async () => await this.pegaClient.getCaseTypeAction(caseTypeID.trim(), actionID.trim()), { caseTypeID, actionID, sessionInfo } ); } catch (error) { return { content: [{ type: 'text', text: `## Error: Get Case Type Action\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 schema: name 'get_case_type_action', description, inputSchema with required parameters caseTypeID and actionID, and optional sessionCredentials.
static getDefinition() { return { name: 'get_case_type_action', description: 'Get detailed information about a case action, including view metadata and available actions', inputSchema: { type: 'object', properties: { caseTypeID: { type: 'string', description: 'ID of the case type for which the case action metadata is being retrieved, for example: Bug' }, actionID: { type: 'string', description: 'Action ID for case type action (Example: "pyUpdateCaseDetails", "pyApproval"). CRITICAL: Action IDs are CASE-SENSITIVE and have no spaces even if display names do ("Edit details" → "pyUpdateCaseDetails"). Use get_case_types to discover available case types and their supported actions.' }, sessionCredentials: getSessionCredentialsSchema() }, required: ['caseTypeID', 'actionID'] } }; } - Overridden response formatter specific to case type actions, providing structured output with session info, action details, UI resources summary, available fields/views/components, and data sources.
formatSuccessResponse(operation, data, options = {}) { const { caseTypeID, actionID, 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`; } // Basic action information response += '### Action Information\n'; response += `- **Case Type**: ${caseTypeID}\n`; response += `- **Action ID**: ${actionID}\n\n`; // Case info content if (data.data && data.data.caseInfo && data.data.caseInfo.content) { response += '### Case Content Structure\n'; const content = data.data.caseInfo.content; if (Object.keys(content).length > 0) { // Display top-level content keys const contentKeys = Object.keys(content); response += `- **Available Fields**: ${contentKeys.length}\n`; response += `- **Main Sections**: ${contentKeys.slice(0, 10).join(', ')}`; if (contentKeys.length > 10) { response += ` (and ${contentKeys.length - 10} more)`; } response += '\n\n'; // Show class information if available if (content.classID) { response += `- **Primary Class**: ${content.classID}\n`; } } else { response += '- No content metadata available\n\n'; } } // UI Resources - this is the rich metadata section if (data.uiResources) { response += '### UI Resources\n'; // Root component information if (data.uiResources.root) { response += '#### Root View Configuration\n'; const root = data.uiResources.root; if (root.config && root.config.name) { response += `- **View Name**: ${root.config.name}\n`; } if (root.type) { response += `- **Component Type**: ${root.type}\n`; } response += '\n'; } // Available resources if (data.uiResources.resources) { const resources = data.uiResources.resources; // Views information if (resources.views) { const viewCount = Object.keys(resources.views).length; response += `#### Available Views (${viewCount})\n`; const viewNames = Object.keys(resources.views).slice(0, 8); viewNames.forEach(viewName => { const viewData = resources.views[viewName]; if (Array.isArray(viewData) && viewData.length > 0) { const view = viewData[0]; response += `- **${viewName}**: ${view.type || 'View'}`; if (view.config && view.config.label) { response += ` ("${view.config.label}")`; } response += '\n'; } }); if (Object.keys(resources.views).length > 8) { response += `- *(and ${Object.keys(resources.views).length - 8} more views)*\n`; } response += '\n'; } // Fields information if (resources.fields) { const fieldCount = Object.keys(resources.fields).length; response += `#### Available Fields (${fieldCount})\n`; const fieldNames = Object.keys(resources.fields).slice(0, 10); fieldNames.forEach(fieldName => { const fieldData = resources.fields[fieldName]; if (Array.isArray(fieldData) && fieldData.length > 0) { const field = fieldData[0]; response += `- **${fieldName}**: ${field.type || 'Unknown'}`; if (field.label) { response += ` ("${field.label}")`; } response += '\n'; } }); if (Object.keys(resources.fields).length > 10) { response += `- *(and ${Object.keys(resources.fields).length - 10} more fields)*\n`; } response += '\n'; } // Components information if (resources.components) { response += `#### UI Components\n`; response += `- **Available Components**: ${resources.components.length}\n`; response += `- **Component Types**: ${resources.components.join(', ')}\n\n`; } // Data pages information if (resources.datapages) { const datapageCount = Object.keys(resources.datapages).length; response += `#### Data Sources (${datapageCount})\n`; Object.keys(resources.datapages).slice(0, 5).forEach(dpName => { const dp = resources.datapages[dpName]; response += `- **${dpName}**: ${dp.mode || 'unknown'} mode`; if (dp.classID) { response += ` (${dp.classID})`; } response += '\n'; }); if (Object.keys(resources.datapages).length > 5) { response += `- *(and ${Object.keys(resources.datapages).length - 5} more data sources)*\n`; } response += '\n'; } } // Action buttons if available if (data.uiResources.actionButtons) { response += '#### Available Actions\n'; const buttons = data.uiResources.actionButtons; if (buttons.main && buttons.main.length > 0) { response += '**Primary Actions**:\n'; buttons.main.forEach(btn => { response += `- ${btn.name} (${btn.actionID})\n`; }); } if (buttons.secondary && buttons.secondary.length > 0) { response += '**Secondary Actions**:\n'; buttons.secondary.forEach(btn => { response += `- ${btn.name} (${btn.actionID})\n`; }); } response += '\n'; } } // Context data if available if (data.uiResources && data.uiResources.context_data) { response += '### Context Information\n'; response += '- Context data available for form initialization\n'; if (data.uiResources.context_data.caseInfo) { response += '- Case context properly configured\n'; } response += '\n'; } return response; } - src/api/pega-client.js:384-386 (helper)Helper method in PegaClient wrapper that delegates to the underlying client library to fetch case type action metadata, invoked by the tool handler.
async getCaseTypeAction(caseTypeID, actionID) { return this.client.getCaseTypeAction(caseTypeID, actionID); } - src/registry/configurable-tool-loader.js:453-454 (registration)Dynamic tool registration loader that scans src/tools/casetypes/, imports get-case-type-action.js, detects the BaseTool subclass by name/execute/getDefinition, instantiates, and registers 'get_case_type_action' in the MCP tool registry.
export const configurableToolLoader = new ConfigurableToolLoader();