Skip to main content
Glama
marco-looy
by marco-looy

get_case_types

Retrieve available case types for creation in a Pega application. Use returned classID as caseTypeID when creating cases.

Instructions

Get list of case types that the user can create in the application. Use returned classID as caseTypeID in create_case. create_case automatically discovers required fields if needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionCredentialsNoOptional 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 for the 'get_case_types' MCP tool. It handles session initialization, calls the underlying PegaClient.getCaseTypes() API, applies standardized error handling, and formats responses.
    async execute(params) { let sessionInfo = null; try { // Initialize session configuration if provided sessionInfo = this.initializeSessionConfig(params); // Execute with standardized error handling return await this.executeWithErrorHandling( 'Available Case Types', async () => await this.pegaClient.getCaseTypes(), { sessionInfo } ); } catch (error) { return { content: [ { type: 'text', text: `## Error: Get Case Types\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 for 'get_case_types', including the tool name, description, and input schema (optional session credentials). This is used for tool discovery and validation in the MCP protocol.
    static getDefinition() { return { name: 'get_case_types', description: 'Get list of case types that the user can create in the application. Use returned classID as caseTypeID in create_case. create_case automatically discovers required fields if needed.', inputSchema: { type: 'object', properties: { sessionCredentials: getSessionCredentialsSchema() }, required: [] } }; }
  • Custom helper method to format successful responses into detailed Markdown output, including session info, case type lists with IDs/names/links, constellation/legacy summaries, quick references, and create_case usage examples.
    formatSuccessResponse(operation, data, options = {}) { const { 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`; response += '\n'; } // Display application compatibility info if (data.applicationIsConstellationCompatible !== undefined) { response += `**Application Type**: ${data.applicationIsConstellationCompatible ? 'Constellation Compatible' : 'Legacy (Pre-8.5)'}\n\n`; } if (data.caseTypes && data.caseTypes.length > 0) { response += `### Case Types Available for Creation (${data.caseTypes.length})\n\n`; data.caseTypes.forEach((caseType, index) => { response += `#### ${index + 1}. ${caseType.name || 'Unnamed Case Type'}\n`; response += `- **ID**: ${caseType.ID}\n`; response += `- **Display Name**: ${caseType.name}\n`; // Display creation link info if (caseType.links && caseType.links.create) { const createLink = caseType.links.create; response += `- **Creation Method**: ${createLink.type || 'POST'} ${createLink.href || '/cases'}\n`; response += `- **Creation Title**: ${createLink.title || 'Create Case'}\n`; if (createLink.request_body && createLink.request_body.caseTypeID) { response += `- **Required Case Type ID**: ${createLink.request_body.caseTypeID}\n`; } } // Display starting processes for legacy case types if (caseType.startingProcesses && caseType.startingProcesses.length > 0) { response += `- **Starting Processes** (${caseType.startingProcesses.length}):\n`; caseType.startingProcesses.forEach((process, procIndex) => { response += ` ${procIndex + 1}. **${process.name}** (ID: ${process.ID})\n`; if (process.requiresFieldsToCreate !== undefined) { response += ` - Requires Fields: ${process.requiresFieldsToCreate ? 'Yes' : 'No'}\n`; } }); } response += '\n'; }); // Summary section response += '### Summary\n'; const constellationTypes = data.caseTypes.filter(ct => !ct.startingProcesses || ct.startingProcesses.length === 0); const legacyTypes = data.caseTypes.filter(ct => ct.startingProcesses && ct.startingProcesses.length > 0); response += `- **Total Case Types**: ${data.caseTypes.length}\n`; if (constellationTypes.length > 0) { response += `- **Constellation Case Types**: ${constellationTypes.length}\n`; } if (legacyTypes.length > 0) { response += `- **Legacy Case Types**: ${legacyTypes.length}\n`; } // Quick reference for case creation response += '\n### Quick Reference for Case Creation\n'; response += 'Use these case type IDs when creating new cases:\n'; data.caseTypes.forEach((caseType, index) => { response += `${index + 1}. **${caseType.name}**: \`${caseType.ID}\`\n`; }); // Usage example section response += '\n### Using Case Types\n\n'; response += 'To create a case of one of these types:\n'; response += '1. Note the **classID** (Example: "UPlus-SAPlus-Work-Lead-Biz")\n'; response += '2. Use `create_case` with that classID as the caseTypeID parameter\n'; response += '3. create_case will automatically discover required fields if needed\n\n'; if (data.caseTypes && data.caseTypes.length > 0) { const firstType = data.caseTypes[0]; response += `**Example**: To create a "${firstType.name}" case:\n`; response += '```json\n'; response += '{\n'; response += ' "caseTypeID": "' + firstType.ID + '",\n'; response += ' "content": {}\n'; response += '}\n```\n'; } } else { response += '### No Case Types Available\n'; response += 'No case types are currently available for creation in this application.\n'; response += 'This may be due to:\n'; response += '- No case types configured in the application\n'; response += '- Current user lacks permissions to create cases\n'; response += '- All case types have `canCreate` set to false in the application definition\n'; } return response; }
  • Underlying API implementation in V1 client that makes the actual HTTP GET request to /prweb/api/v1/casetypes to retrieve available case types. Called by the tool handler via PegaClient proxy.
    async getCaseTypes() { const url = `${this.getApiBaseUrl()}/casetypes`; return await this.makeRequest(url, { method: 'GET', headers: { 'x-origin-channel': 'Web' } }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/marco-looy/pega-dx-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server