Skip to main content
Glama
marco-looy

Pega DX MCP Server

by marco-looy

add_optional_process

Initiate optional case actions configured as processes and retrieve the next assignment details for stage-specific or case-wide workflows.

Instructions

Add stage or case-wide optional process and return details of the next assignment in the process. The API is invoked when a user tries to initiate an optional action listed under case actions which are configured and designed as a process under case wide actions or stage-only actions.

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.
processIDYesProcess ID - Name of the process which is the ID of a flow rule. Example: "UpdateContactDetails". ProcessID can be retrieved with a lookup for ID attribute under availableProcesses node of a DX API response.
viewTypeNoUI resources to return. "none" returns no uiResources, data.caseInfo.content contains the fields of the pyDetails view (default), "form" returns the form UI metadata (read-only review mode, without page-specific metadata) in the uiResources object, "page" returns the full page (read-only review mode) UI metadata in the uiResources object.none
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's core logic: validates inputs, initializes session, and calls the Pega API to add an optional process to a case.
    async execute(params) {
      const { caseID, processID, viewType } = 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', 'processID']);
        if (requiredValidation) {
          return requiredValidation;
        }
    
        // Validate enum parameters using base class
        const enumValidation = this.validateEnumParams(params, {
          viewType: ['none', 'form', 'page']
        });
        if (enumValidation) {
          return enumValidation;
        }
    
        // Execute with standardized error handling
        return await this.executeWithErrorHandling(
          `Add Optional Process: ${processID} to case ${caseID}`,
          async () => await this.pegaClient.addOptionalProcess(caseID.trim(), processID.trim(), { viewType }),
          { processID, viewType, sessionInfo }
        );
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `## Error: Add Optional Process\n\n**Unexpected Error**: ${error.message}\n\n${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*`
          }]
        };
      }
    }
  • Defines the tool schema for MCP, including name, description, input parameters (caseID, processID, optional viewType and sessionCredentials), and validation rules.
    static getDefinition() {
      return {
        name: 'add_optional_process',
        description: 'Add stage or case-wide optional process and return details of the next assignment in the process. The API is invoked when a user tries to initiate an optional action listed under case actions which are configured and designed as a process under case wide actions or stage-only actions.',
        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.'
            },
            processID: {
              type: 'string',
              description: 'Process ID - Name of the process which is the ID of a flow rule. Example: "UpdateContactDetails". ProcessID can be retrieved with a lookup for ID attribute under availableProcesses node of a DX API response.'
            },
            viewType: {
              type: 'string',
              enum: ['none', 'form', 'page'],
              description: 'UI resources to return. "none" returns no uiResources, data.caseInfo.content contains the fields of the pyDetails view (default), "form" returns the form UI metadata (read-only review mode, without page-specific metadata) in the uiResources object, "page" returns the full page (read-only review mode) UI metadata in the uiResources object.',
              default: 'none'
            },
            sessionCredentials: getSessionCredentialsSchema()
          },
          required: ['caseID', 'processID']
        }
      };
    }
  • Static method returning the tool category 'cases', used by the dynamic tool loader for categorization and discovery.
    static getCategory() {
      return 'cases';
    }
  • Helper method in PegaClient that routes the addOptionalProcess call to the appropriate API version client (V1/V2), enforcing feature availability checks.
    async addOptionalProcess(caseID, processID, options = {}) {
      if (!this.isFeatureAvailable('stageNavigation')) {
        this.throwUnsupportedFeatureError('stageNavigation', 'addOptionalProcess');
      }
      return this.client.addOptionalProcess(caseID, processID, options);
    }
  • Dynamic tool loader instance that discovers and registers all tools, including add_optional_process, by scanning directories and using getDefinition().
    export const toolLoader = new ToolLoader();
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the tool adds a process and returns details of the next assignment, which implies a mutation (adding) and a read (returning details). However, it fails to disclose critical behavioral traits such as whether this requires specific permissions, if it's idempotent, what happens on failure, or any rate limits. The description adds minimal context beyond the basic action, leaving significant gaps for a mutation tool.

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 front-loaded with the core purpose in the first sentence, followed by contextual usage in the second. Both sentences are necessary and earn their place by clarifying the action and when to use it. There is no redundant or verbose language, making it efficient. However, the second sentence is slightly complex and could be streamlined for better clarity, but it remains concise overall.

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

Completeness2/5

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

Given the complexity (mutation tool with 4 parameters, nested objects, no output schema, and no annotations), the description is incomplete. It explains what the tool does and when to use it but lacks details on behavioral aspects (e.g., permissions, side effects), output format (since no output schema), and error handling. For a tool that modifies data and returns assignment details, this leaves significant gaps for an AI agent to operate effectively.

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 documents all parameters thoroughly (e.g., caseID, processID, viewType with enum details, sessionCredentials with authentication modes). The description does not add any meaningful parameter semantics beyond what the schema provides; it only implicitly references caseID and processID in the context. Given the high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 action ('Add stage or case-wide optional process') and the outcome ('return details of the next assignment in the process'), which is specific and actionable. It distinguishes the tool from siblings like 'perform_case_action' or 'change_to_next_stage' by focusing on optional processes configured under case actions. However, it doesn't explicitly differentiate from 'get_next_assignment' or 'get_assignment', which might also return assignment details, leaving some ambiguity.

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

Usage Guidelines3/5

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

The description implies usage context ('when a user tries to initiate an optional action listed under case actions which are configured and designed as a process under case wide actions or stage-only actions'), which helps understand when to invoke it. However, it lacks explicit guidance on when not to use it or alternatives (e.g., vs. 'perform_case_action' for non-process actions or 'get_next_assignment' for existing processes). This leaves room for interpretation but provides basic context.

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