Skip to main content
Glama
marco-looy

Pega DX MCP Server

by marco-looy

get_cases

Retrieve up to 500 cases created by the authenticated user, sorted from oldest to newest. Requires pxGetCases privilege and is designed for V1 users (V2 users should use Data Views instead).

Instructions

Get all cases created by authenticated user (V1 EXCLUSIVE - max 500 cases, oldest to newest). V2 users should use Data Views instead. Requires pxGetCases privilege.

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

  • Core handler logic for the get_cases tool: initializes session configuration, enforces V1 API requirement, calls pegaClient.getAllCases(), and provides standardized error handling.
      async execute(params) {
        let sessionInfo = null;
    
        try {
          // Initialize session configuration if provided
          sessionInfo = this.initializeSessionConfig(params);
    
          // Check API version
          const apiVersion = this.pegaClient.getApiVersion();
          if (apiVersion !== 'v1') {
            return {
              content: [{
                type: 'text',
                text: `## Error: Get Cases (V1 Exclusive)
    
    **Version Mismatch**: This endpoint is only available in Traditional DX API (V1).
    
    **Current API Version**: ${apiVersion.toUpperCase()}
    
    **Solution**: Set \`PEGA_API_VERSION=v1\` environment variable to use this endpoint.
    
    **V2 Alternative**: Use Data Views to query cases:
    - Tool: \`get_list_data_view\`
    - Data View: \`D_MyCaseList\` or similar case list data view
    - Filter by: \`pyCreatedBy\` = current user
    
    ${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*`
              }]
            };
          }
    
          // Execute with standardized error handling
          return await this.executeWithErrorHandling(
            'Get All Cases (V1)',
            async () => await this.pegaClient.getAllCases(),
            { sessionInfo }
          );
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `## Error: Get Cases
    
    **Unexpected Error**: ${error.message}
    
    ${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*`
            }]
          };
        }
      }
  • Tool schema definition for MCP protocol, specifying name 'get_cases', detailed description, and optional sessionCredentials input schema.
    static getDefinition() {
      return {
        name: 'get_cases',
        description: 'Get all cases created by authenticated user (V1 EXCLUSIVE - max 500 cases, oldest to newest). V2 users should use Data Views instead. Requires pxGetCases privilege.',
        inputSchema: {
          type: 'object',
          properties: {
            sessionCredentials: getSessionCredentialsSchema()
          },
          required: []
        }
      };
  • Custom response formatter for get_cases results: displays metadata, groups cases by status, details first 10 cases, warns on truncation, includes V1-specific notes.
    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\n`;
      }
    
      // Display metadata prominently
      if (data.metadata) {
        response += '### 📊 Results Metadata\n';
        response += `- **Total Cases Retrieved**: ${data.metadata.count}\n`;
        response += `- **Maximum Records**: ${data.metadata.maxRecords} (pyMaxRecords DSS)\n`;
        response += `- **API Version**: ${data.metadata.apiVersion.toUpperCase()}\n`;
        response += `- **Order**: Oldest to Newest\n\n`;
    
        if (data.metadata.count === data.metadata.maxRecords) {
          response += `⚠️  **Warning**: Result set may be truncated at ${data.metadata.maxRecords} records.\n\n`;
        }
      }
    
      // Cases section header
      response += '### 📋 Cases\n\n';
    
      // Display cases summary
      if (data.data && data.data.cases && data.data.cases.length > 0) {
        response += `**Found ${data.data.cases.length} cases**\n\n`;
    
        // Group cases by status for better overview
        const casesByStatus = {};
        data.data.cases.forEach(c => {
          const status = c.status || 'Unknown';
          if (!casesByStatus[status]) {
            casesByStatus[status] = [];
          }
          casesByStatus[status].push(c);
        });
    
        response += '#### Status Summary\n';
        Object.keys(casesByStatus).forEach(status => {
          response += `- **${status}**: ${casesByStatus[status].length} cases\n`;
        });
        response += '\n';
    
        // Display first 10 cases in detail
        response += '#### Case Details (First 10)\n\n';
        const casesToShow = data.data.cases.slice(0, 10);
        casesToShow.forEach((caseObj, index) => {
          response += `##### ${index + 1}. ${caseObj.ID}\n`;
          response += `- **Case Type**: ${caseObj.caseTypeID || 'N/A'}\n`;
          response += `- **Name**: ${caseObj.name || 'N/A'}\n`;
          response += `- **Status**: ${caseObj.status || 'N/A'}\n`;
          response += `- **Stage**: ${caseObj.stage || 'N/A'}\n`;
          response += `- **Urgency**: ${caseObj.urgency || 0}\n`;
          response += `- **Created**: ${caseObj.createTime || 'N/A'} by ${caseObj.createdBy || 'N/A'}\n`;
          response += `- **Last Updated**: ${caseObj.lastUpdateTime || 'N/A'} by ${caseObj.lastUpdatedBy || 'N/A'}\n`;
          if (caseObj.parentCaseID) {
            response += `- **Parent Case**: ${caseObj.parentCaseID}\n`;
          }
          response += '\n';
        });
    
        if (data.data.cases.length > 10) {
          response += `*... and ${data.data.cases.length - 10} more cases*\n\n`;
        }
      } else {
        response += 'No cases found for the authenticated user.\n\n';
      }
    
      // Add V1 notes
      response += '### 📝 V1 API Notes\n';
      response += '- This endpoint is V1 EXCLUSIVE (not available in V2)\n';
      response += '- Returns cases from user\'s default work pool only\n';
      response += '- Maximum 500 cases (controlled by pyMaxRecords DSS)\n';
      response += '- No pagination or filtering options\n';
      response += '- Cases ordered from oldest to newest\n';
      response += '- Requires pxGetCases privilege\n\n';
    
      return response;
    }
  • Low-level HTTP implementation of getAllCases for V1 API: GET /prweb/api/v1/cases, transforms flat V1 response to standardized structure with metadata (max 500 cases).
    async getAllCases() {
      const url = `${this.getApiBaseUrl()}/cases`;
    
      const response = await this.makeRequest(url, {
        method: 'GET',
        headers: {
          'x-origin-channel': 'Web'
        }
      });
    
      if (!response.success) {
        return response;
      }
    
      // Transform response for consistency
      return {
        success: true,
        data: {
          cases: response.data.cases.map(c => ({
            ID: c.ID,
            parentCaseID: c.parentCaseID,
            caseTypeID: c.caseTypeID,
            name: c.name,
            stage: c.stage,
            status: c.status,
            urgency: parseInt(c.urgency) || 0,
            createTime: c.createTime,
            createdBy: c.createdBy,
            lastUpdateTime: c.lastUpdateTime,
            lastUpdatedBy: c.lastUpdatedBy
          }))
        },
        metadata: {
          count: response.data.cases.length,
          maxRecords: 500, // From pyMaxRecords DSS
          apiVersion: 'v1'
        }
      };
    }
  • Static method returning tool category 'cases', used by tool loader for automatic discovery and categorization in src/registry/tool-loader.js.
    static getCategory() {
      return 'cases';
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and delivers well: it discloses the V1 exclusivity, 500-case limit, ordering (oldest to newest), and privilege requirement. It doesn't mention pagination, error handling, or response format, but covers key behavioral constraints effectively.

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

Conciseness5/5

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

Three sentences with zero waste: first states purpose and constraints, second gives version guidance, third states privilege requirement. Each sentence earns its place by providing critical information. The structure is front-loaded with the core functionality.

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

Completeness4/5

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

For a read operation with no annotations, no output schema, and 1 parameter (100% covered), the description is nearly complete. It covers purpose, constraints, alternatives, and auth needs. The main gap is lack of output format details, but given the context, it provides sufficient guidance for agent usage.

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

Parameters4/5

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

Schema description coverage is 100%, so baseline is 3. The description adds value by implying no parameters are needed for the core operation (authenticated user's cases), which helps agents understand the optional 'sessionCredentials' parameter is for authentication override rather than case filtering. This clarifies semantics beyond the schema.

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

Purpose5/5

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

The description clearly states the specific action ('Get all cases'), resource ('cases'), scope ('created by authenticated user'), and constraints ('V1 EXCLUSIVE - max 500 cases, oldest to newest'). It distinguishes itself from siblings like 'get_case' (singular) and 'get_list_data_view' (V2 alternative).

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

Usage Guidelines5/5

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

Explicit guidance is provided: 'V2 users should use Data Views instead' names the alternative tool, and 'Requires pxGetCases privilege' states a prerequisite. This tells agents exactly when to use this tool (V1 users needing all their cases) versus when not to (V2 users should use Data Views).

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