import { BaseTool } from '../../registry/base-tool.js';
import { getSessionCredentialsSchema } from '../../utils/tool-schema.js';
export class GetParticipantTool extends BaseTool {
/**
* Get the category this tool belongs to
*/
static getCategory() {
return 'participants';
}
/**
* Get tool definition for MCP protocol
*/
static getDefinition() {
return {
name: 'get_participant',
description: 'Get detailed information about a specific participant in a Pega case by case ID and participant ID. Returns participant details including personal information, contact details, and optional UI resources for form display.',
inputSchema: {
type: 'object',
properties: {
caseID: {
type: 'string',
description: 'Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces."ON6E5R-DIYRecipe-Work-RecipeCollection R-1008". a complete case identifier including spaces and special characters.'
},
participantID: {
type: 'string',
description: 'Participant ID to get details for. This identifies the specific participant within the case whose information you want to retrieve.'
},
viewType: {
type: 'string',
enum: ['form', 'none'],
description: 'UI resources to return. "form" returns form UI metadata in uiResources object for display purposes, "none" returns no UI resources. Default: "form".',
default: 'form'
},
sessionCredentials: getSessionCredentialsSchema()
},
required: ['caseID', 'participantID']
}
};
}
/**
* Execute the get participant operation
*/
async execute(params) {
const { caseID, participantID, viewType } = params;
let sessionInfo = null;
try {
sessionInfo = this.initializeSessionConfig(params);
// Validate required parameters using base class
const requiredValidation = this.validateRequiredParams(params, ['caseID', 'participantID']);
if (requiredValidation) {
return requiredValidation;
}
// Validate enum parameters using base class
const enumValidation = this.validateEnumParams(params, {
viewType: ['form', 'none']
});
if (enumValidation) {
return enumValidation;
}
// Execute with standardized error handling
return await this.executeWithErrorHandling(
`Get Participant: ${caseID.trim()} / ${participantID.trim()}`,
async () => await this.pegaClient.getParticipant(caseID.trim(), participantID.trim(), { viewType }),
{ caseID: caseID.trim(), participantID: participantID.trim(), viewType, sessionInfo }
);
} catch (error) {
return {
content: [{
type: 'text',
text: `## Error: Get Participant: ${caseID} / ${participantID}\n\n**Unexpected Error**: ${error.message}\n\n${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*`
}]
};
}
}
}