Skip to main content
Glama
marco-looy

Pega DX MCP Server

by marco-looy

diagnose_pega_config

Diagnose Pega configuration and environment variables to identify and resolve connection issues by displaying current configuration settings while protecting sensitive information.

Instructions

Diagnose Pega configuration and environment variables to troubleshoot connection issues. Shows what configuration the MCP server is using (without exposing secrets).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute method of DiagnoseConfigTool implements the core logic for the 'diagnose_pega_config' tool. It inspects environment variables, loaded Pega configuration, authentication status, runs validation checks, masks sensitive data, and generates a comprehensive Markdown diagnostic report.
    async execute(params) {
      try {
        const config = this.pegaClient.client.config.pega;
        const oauth2Client = this.pegaClient.client.oauth2Client;
    
        // Mask sensitive values
        const maskValue = (value) => {
          if (!value) return '❌ NOT SET';
          if (value.length <= 4) return '***';
          return value.substring(0, 4) + '***' + value.substring(value.length - 4);
        };
    
        let response = `## Pega Configuration Diagnostics\n\n`;
        response += `*Generated at: ${new Date().toISOString()}*\n\n`;
    
        // Environment Variables Status
        response += `### Environment Variables\n`;
        response += `- **PEGA_BASE_URL**: ${process.env.PEGA_BASE_URL || '❌ NOT SET'}\n`;
        response += `- **PEGA_API_VERSION**: ${process.env.PEGA_API_VERSION || '❌ NOT SET (defaults to v2)'}\n`;
        response += `- **PEGA_CLIENT_ID**: ${maskValue(process.env.PEGA_CLIENT_ID)}\n`;
        response += `- **PEGA_CLIENT_SECRET**: ${maskValue(process.env.PEGA_CLIENT_SECRET)}\n`;
        response += `\n`;
    
        // Loaded Configuration
        response += `### Loaded Configuration\n`;
        response += `- **Base URL**: ${config.baseUrl || '❌ NOT SET'}\n`;
        response += `- **API Version**: ${config.apiVersion}\n`;
        response += `- **Client ID**: ${maskValue(config.clientId)}\n`;
        response += `- **Client Secret**: ${maskValue(config.clientSecret)}\n`;
        response += `- **Token URL**: ${config.tokenUrl || '❌ NOT SET'}\n`;
        response += `- **API Base URL**: ${config.apiBaseUrl || '❌ NOT SET'}\n`;
        response += `\n`;
    
        // Authentication Status
        response += `### Authentication Status\n`;
        const tokenInfo = oauth2Client.getTokenInfo();
        response += `- **Auth Mode**: ${tokenInfo.authMode.toUpperCase()}\n`;
        response += `- **Has Token**: ${tokenInfo.hasToken ? '✅ Yes' : '❌ No'}\n`;
        response += `- **Token Expired**: ${tokenInfo.isExpired ? '⚠️ Yes' : '✅ No'}\n`;
        response += `- **Config Source**: ${tokenInfo.configSource}\n`;
        response += `- **Cache Key**: ${tokenInfo.cacheKey}\n`;
        if (tokenInfo.hasToken && !tokenInfo.isExpired) {
          response += `- **Expires In**: ${tokenInfo.expiresInMinutes} minutes\n`;
        }
        response += `\n`;
    
        // Validation Checks
        response += `### Validation Checks\n`;
        const checks = [
          {
            name: 'Base URL set',
            passed: !!config.baseUrl,
            message: config.baseUrl ? '✅ Pass' : '❌ Fail - PEGA_BASE_URL not set'
          },
          {
            name: 'Client ID set',
            passed: !!config.clientId,
            message: config.clientId ? '✅ Pass' : '❌ Fail - PEGA_CLIENT_ID not set'
          },
          {
            name: 'Client Secret set',
            passed: !!config.clientSecret,
            message: config.clientSecret ? '✅ Pass' : '❌ Fail - PEGA_CLIENT_SECRET not set'
          },
          {
            name: 'Base URL format',
            passed: config.baseUrl && config.baseUrl.startsWith('http'),
            message: config.baseUrl && config.baseUrl.startsWith('http') ? '✅ Pass' : '❌ Fail - Invalid URL format'
          },
          {
            name: 'No /prweb in Base URL',
            passed: config.baseUrl && !config.baseUrl.includes('/prweb'),
            message: config.baseUrl && !config.baseUrl.includes('/prweb') ? '✅ Pass' : '⚠️ Warning - /prweb will be auto-cleaned'
          }
        ];
    
        for (const check of checks) {
          response += `- **${check.name}**: ${check.message}\n`;
        }
        response += `\n`;
    
        // Next Steps
        const allChecksPass = checks.every(c => c.passed);
        if (allChecksPass) {
          response += `### Status: ✅ Configuration Valid\n\n`;
          response += `All configuration checks passed. If you're still experiencing issues:\n`;
          response += `1. Try using the \`authenticate_pega\` tool to test authentication\n`;
          response += `2. Verify network connectivity to: ${config.baseUrl}\n`;
          response += `3. Check OAuth client configuration in Pega Infinity\n`;
        } else {
          response += `### Status: ❌ Configuration Issues Detected\n\n`;
          response += `Please fix the failing validation checks above.\n\n`;
          response += `**For MCP servers run via npx:**\n`;
          response += `- Ensure environment variables are set in your MCP client config\n`;
          response += `- Restart your MCP client completely after updating config\n\n`;
          response += `**For local development:**\n`;
          response += `- Create a \`.env\` file in the project root\n`;
          response += `- Set PEGA_BASE_URL, PEGA_CLIENT_ID, PEGA_CLIENT_SECRET\n`;
        }
    
        return {
          content: [
            {
              type: 'text',
              text: response
            }
          ]
        };
    
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `## Error: Diagnose Configuration\n\n**Error**: ${error.message}\n\n*Error occurred at: ${new Date().toISOString()}*`
            }
          ]
        };
      }
    }
  • The getDefinition static method provides the MCP tool schema, including the name 'diagnose_pega_config', description, and inputSchema (no input parameters required).
    static getDefinition() {
      return {
        name: 'diagnose_pega_config',
        description: 'Diagnose Pega configuration and environment variables to troubleshoot connection issues. Shows what configuration the MCP server is using (without exposing secrets).',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      };
    }
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 does well by disclosing key behavioral traits: it's a diagnostic/read-only operation (implied by 'diagnose', 'shows'), it reveals configuration details, and importantly specifies security behavior ('without exposing secrets'). However, it doesn't mention rate limits, performance characteristics, or exact output format.

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?

Two concise sentences with zero waste. First sentence states purpose and context, second sentence clarifies scope and security boundary. Every word earns its place in this efficiently structured description.

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 parameterless diagnostic tool with no annotations and no output schema, the description provides good coverage: purpose, usage context, security behavior, and scope. It could be slightly more complete by hinting at output format or mentioning it's safe for frequent use, but overall does well given the tool's simplicity.

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?

With 0 parameters and 100% schema description coverage, the baseline is 4. The description appropriately explains this is a parameterless diagnostic tool that examines the current configuration/environment, which adds meaningful context beyond the empty 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 tool's purpose with specific verbs ('diagnose', 'troubleshoot') and resources ('Pega configuration', 'environment variables', 'connection issues'). It distinguishes itself from sibling tools by focusing on diagnostic/read-only functionality rather than case/assignment/data manipulation operations.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('to troubleshoot connection issues'), but doesn't explicitly state when NOT to use it or mention specific alternatives. The context is sufficient given this is a unique diagnostic tool among many CRUD operations.

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