Skip to main content
Glama
marco-looy

Pega DX MCP Server

by marco-looy

get_case_stages

Retrieve case stages with processes, steps, and visited status for a specific case ID to track workflow progress and understand current status.

Instructions

Retrieve the stages list for a given case ID with processes, steps, and visited status information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
caseIDYesCase ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces.
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 executes the tool: destructures caseID, initializes session config if provided, validates parameters, and calls pegaClient.getCaseStages with standardized error handling and response formatting.
    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 Stages: ${caseID}`,
          async () => await this.pegaClient.getCaseStages(caseID.trim()),
          { caseID, sessionInfo }
        );
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `## Error: Get Case Stages\n\n**Unexpected Error**: ${error.message}\n\n${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*`
          }]
        };
      }
    }
  • Static method providing the MCP tool definition including name, description, and input schema requiring 'caseID'.
    static getDefinition() {
      return {
        name: 'get_case_stages',
        description: 'Retrieve the stages list for a given case ID with processes, steps, and visited status information.',
        inputSchema: {
          type: 'object',
          properties: {
            caseID: {
              type: 'string',
              description: 'Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces.'
            },
            sessionCredentials: getSessionCredentialsSchema()
          },
          required: ['caseID']
        }
      };
    }
  • Overridden helper method for formatting successful responses specific to case stages, including stage overview, visited status, processes, steps, and overall progress summary.
    formatSuccessResponse(operation, data, options = {}) {
      const { caseID, 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 stages information
      if (data.stages && Array.isArray(data.stages)) {
        response += `### Stage Overview\n`;
        response += `- **Total Stages**: ${data.stages.length}\n`;
        
        // Count visited and unvisited stages
        const visitedStages = data.stages.filter(stage => stage.visited === true);
        const unvisitedStages = data.stages.filter(stage => stage.visited === false);
        
        response += `- **Visited Stages**: ${visitedStages.length}\n`;
        response += `- **Remaining Stages**: ${unvisitedStages.length}\n\n`;
    
        // Display each stage with details
        data.stages.forEach((stage, stageIndex) => {
          const stageNumber = stageIndex + 1;
          const visitedIcon = stage.visited ? '✅' : '⏸️';
          const stageType = stage.stageType || 'Primary';
          
          response += `### ${visitedIcon} Stage ${stageNumber}: ${stage.name}\n`;
          response += `- **Type**: ${stageType}\n`;
          response += `- **Status**: ${stage.visited ? 'Visited' : 'Not Visited'}\n`;
          
          if (stage.description) {
            response += `- **Description**: ${stage.description}\n`;
          }
    
          // Display processes within the stage
          if (stage.processes && Array.isArray(stage.processes)) {
            response += `- **Processes**: ${stage.processes.length}\n\n`;
            
            stage.processes.forEach((process, processIndex) => {
              const processNumber = processIndex + 1;
              const processVisitedIcon = process.visited ? '✅' : '⏸️';
              
              response += `#### ${processVisitedIcon} Process ${stageNumber}.${processNumber}: ${process.name}\n`;
              response += `   - **Status**: ${process.visited ? 'Visited' : 'Not Visited'}\n`;
              
              if (process.description) {
                response += `   - **Description**: ${process.description}\n`;
              }
    
              // Display steps within the process
              if (process.steps && Array.isArray(process.steps)) {
                response += `   - **Steps**: ${process.steps.length}\n`;
                
                process.steps.forEach((step, stepIndex) => {
                  const stepNumber = stepIndex + 1;
                  const stepVisitedIcon = step.visited ? '✅' : '⏸️';
                  
                  response += `      ${stepVisitedIcon} **Step ${stageNumber}.${processNumber}.${stepNumber}**: ${step.name}`;
                  response += ` (${step.visited ? 'Visited' : 'Not Visited'})\n`;
                  
                  if (step.description) {
                    response += `         - ${step.description}\n`;
                  }
                });
              }
              response += '\n';
            });
          } else {
            response += '\n';
          }
        });
    
        // Summary section
        response += '### Progress Summary\n';
        const totalProcesses = data.stages.reduce((sum, stage) => 
          sum + (stage.processes ? stage.processes.length : 0), 0);
        const visitedProcesses = data.stages.reduce((sum, stage) => 
          sum + (stage.processes ? stage.processes.filter(p => p.visited).length : 0), 0);
        
        const totalSteps = data.stages.reduce((sum, stage) => 
          sum + (stage.processes ? stage.processes.reduce((pSum, process) => 
            pSum + (process.steps ? process.steps.length : 0), 0) : 0), 0);
        const visitedSteps = data.stages.reduce((sum, stage) => 
          sum + (stage.processes ? stage.processes.reduce((pSum, process) => 
            pSum + (process.steps ? process.steps.filter(s => s.visited).length : 0), 0) : 0), 0);
    
        if (totalProcesses > 0) {
          response += `- **Processes**: ${visitedProcesses}/${totalProcesses} completed\n`;
        }
        
        if (totalSteps > 0) {
          response += `- **Steps**: ${visitedSteps}/${totalSteps} completed\n`;
        }
    
        // Progress percentage
        if (totalSteps > 0) {
          const progressPercent = Math.round((visitedSteps / totalSteps) * 100);
          response += `- **Overall Progress**: ${progressPercent}%\n`;
        }
    
      } else if (data.stages) {
        response += '### Stages Information\n';
        response += '- Stages data available but not in expected array format\n';
        response += `- Raw data type: ${typeof data.stages}\n`;
      } else {
        response += '### No Stages Information\n';
        response += '- No stages data found for this case\n';
      }
      
      return response;
    }
  • API client wrapper method that calls the underlying Pega client to fetch case stages for the given caseID.
    async getCaseStages(caseID) {
      return this.client.getCaseStages(caseID);
  • Dynamic registration in ToolLoader: instantiates the tool class, retrieves name from getDefinition(), and registers in loadedTools map by name. This loader scans src/tools directories to auto-register all tools.
    const toolInstance = new ToolClass();
    const toolName = ToolClass.getDefinition().name;
    
    this.loadedTools.set(toolName, {
      instance: toolInstance,
      class: ToolClass,
      category: category,
      filename: filename
    });
    
    return toolInstance;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. While 'retrieve' implies a read operation, it doesn't disclose authentication requirements (though hinted in schema), rate limits, error conditions, or what happens with invalid case IDs. The description mentions what information is returned but not format or structure. For a tool with no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It wastes no words and gets straight to the point. However, it could be slightly more structured by separating the retrieval action from the information details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only tool with 100% schema coverage but no annotations and no output schema, the description provides adequate basic purpose but lacks important context. It doesn't explain authentication requirements (though hinted in schema), error handling, or return format. Given the complexity of the sessionCredentials parameter and absence of output schema, more completeness would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters. The description adds no additional parameter semantics beyond what's in the schema - it mentions 'case ID' but provides no extra context about format or validation. The baseline of 3 is appropriate when the schema does all the parameter documentation work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('retrieve') and resource ('stages list for a given case ID'), specifying what information is included ('processes, steps, and visited status information'). It distinguishes from siblings like 'get_case' or 'get_case_view' by focusing specifically on stages. However, it doesn't explicitly contrast with similar tools like 'change_to_stage' or 'jump_to_step'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools related to cases and stages (e.g., 'get_case', 'change_to_stage', 'jump_to_step'), there's no indication of when this specific retrieval is appropriate versus broader case queries or stage manipulation tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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