Skip to main content
Glama
marco-looy

Pega DX MCP Server

by marco-looy

get_case_view_calculated_fields

Retrieve calculated field values from a specific case view in Pega, evaluating only requested fields that exist within that view.

Instructions

Get calculated fields for a given case view. Retrieves only the requested calculated fields from the case view. All requested calculated fields in the request body must be included in the view. Any requested fields that are not part of the view will be filtered out.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
caseIDYesCase ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces."MYORG-SERVICES-WORK S-293001". a complete case identifier including spaces and special characters.
viewIDYesName of the view from which calculated fields are retrieved - ID of the view rule. This identifies the specific view containing the calculated fields to be evaluated.
calculationsYesObject containing the fields data to retrieve their respective calculated values. Must contain a "fields" array with field objects.
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 main handler function that performs parameter validation, session handling, and calls the Pega client to retrieve calculated fields for a case view.
    async execute(params) { const { caseID, viewID, calculations } = 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', 'calculations']); if (requiredValidation) { return requiredValidation; } // Additional validation for calculations structure if (!calculations || typeof calculations !== 'object' || Array.isArray(calculations)) { return { error: 'Invalid calculations parameter. an object containing field specifications.' }; } if (!calculations.fields || !Array.isArray(calculations.fields) || calculations.fields.length === 0) { return { error: 'Invalid calculations.fields parameter. a non-empty array of field objects.' }; } // Validate each field object for (let i = 0; i < calculations.fields.length; i++) { const field = calculations.fields[i]; if (!field || typeof field !== 'object' || Array.isArray(field)) { return { error: `Invalid field object at index ${i}. an object with required 'name' property.` }; } if (!field.name || typeof field.name !== 'string' || field.name.trim() === '') { return { error: `Invalid field name at index ${i}. a non-empty string.` }; } if (field.context !== undefined && (typeof field.context !== 'string' || field.context.trim() === '')) { return { error: `Invalid field context at index ${i}. When provided, must be a non-empty string.` }; } } // Validate whens array if provided if (calculations.whens !== undefined) { if (!Array.isArray(calculations.whens)) { return { error: 'Invalid calculations.whens parameter. an array of when condition objects.' }; } for (let i = 0; i < calculations.whens.length; i++) { const when = calculations.whens[i]; if (!when || typeof when !== 'object' || Array.isArray(when)) { return { error: `Invalid when object at index ${i}. an object with required 'name' property.` }; } if (!when.name || typeof when.name !== 'string' || when.name.trim() === '') { return { error: `Invalid when name at index ${i}. a non-empty string.` }; } if (when.context !== undefined && (typeof when.context !== 'string' || when.context.trim() === '')) { return { error: `Invalid when context at index ${i}. When provided, must be a non-empty string.` }; } } } // Execute with standardized error handling return await this.executeWithErrorHandling( `Case View Calculated Fields: ${viewID} for ${caseID}`, async () => await this.pegaClient.getCaseViewCalculatedFields( caseID.trim(), viewID.trim(), calculations ), { caseID, viewID, calculations, sessionInfo } ); } catch (error) { return { content: [{ type: 'text', text: `## Error: Get Case View Calculated Fields\n\n**Unexpected Error**: ${error.message}\n\n${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*` }] }; } }
  • Static method defining the tool's name, description, and detailed input schema for MCP protocol compliance.
    static getDefinition() { return { name: 'get_case_view_calculated_fields', description: 'Get calculated fields for a given case view. Retrieves only the requested calculated fields from the case view. All requested calculated fields in the request body must be included in the view. Any requested fields that are not part of the view will be filtered out.', inputSchema: { type: 'object', properties: { caseID: { type: 'string', description: 'Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces."MYORG-SERVICES-WORK S-293001". a complete case identifier including spaces and special characters.' }, viewID: { type: 'string', description: 'Name of the view from which calculated fields are retrieved - ID of the view rule. This identifies the specific view containing the calculated fields to be evaluated.' }, calculations: { type: 'object', description: 'Object containing the fields data to retrieve their respective calculated values. Must contain a "fields" array with field objects.', properties: { fields: { type: 'array', description: 'Array of field objects specifying which calculated fields to retrieve from the view.', items: { type: 'object', properties: { name: { type: 'string', description: 'Name of the calculated field to retrieve. Can include property references starting with dot notation (Example: ".LoanEligibilityCheckListCountAll").' }, context: { type: 'string', description: 'Context for the calculated field evaluation. Optional parameter that specifies the context in which the field should be evaluated. Default: "content".', default: 'content' } }, required: ['name'], additionalProperties: false }, minItems: 1 }, whens: { type: 'array', description: 'Array of when condition objects for conditional field evaluation. Optional parameter for advanced field calculation scenarios.', items: { type: 'object', properties: { name: { type: 'string', description: 'Name of the when condition.' }, context: { type: 'string', description: 'Context for the when condition evaluation.' } }, required: ['name'], additionalProperties: false } } }, required: ['fields'], additionalProperties: false }, sessionCredentials: getSessionCredentialsSchema() }, required: ['caseID', 'viewID', 'calculations'] } };
  • PegaClient router method that checks API version compatibility and delegates the calculated fields request to the appropriate V1/V2 client implementation.
    async getCaseViewCalculatedFields(caseID, viewID, calculations) { if (!this.isFeatureAvailable('uiMetadata')) { this.throwUnsupportedFeatureError('uiMetadata', 'getCaseViewCalculatedFields'); } return this.client.getCaseViewCalculatedFields(caseID, viewID, calculations); }
  • Dynamic registration logic in ToolLoader that instantiates the tool class and registers it by name in the loaded tools map during directory scanning.
    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) {

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