get_attachment_categories
Retrieve available attachment categories for a Pega case, filtered by type (File or URL), with user permission details for each category.
Instructions
Retrieve the list of attachment categories available for a specific Pega case, filtered by attachment type (File or URL). Returns category metadata including user permissions (view, create, edit, delete) for each attachment category associated with the case type. The API uses the class name from the caseID to get attachment categories and filters them based on the type parameter. Only attachment categories configured in the Attachment Category rule are returned. Useful for understanding what attachment categories are available and what operations the current user can perform on each category.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| caseID | Yes | Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces."OSIEO3-DOCSAPP-WORK T-561003". The API uses the class name from this caseID to determine which attachment categories are associated with the case type. | |
| type | No | Filter for the attachment type to retrieve categories for. Case insensitive. "File" or "file" returns all attachment categories of type File. "URL" or "url" returns attachment categories of type URL. Default value is "File". The API returns attachment categories of either type File or type URL during a particular API call, not both simultaneously. | File |
| sessionCredentials | No | Optional 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
- Main handler function that executes the tool logic: validates inputs, normalizes parameters, calls Pega API via pegaClient.getCaseAttachmentCategories, and handles errors.async execute(params) { const { caseID, type = 'File' } = params; let sessionInfo = null; try { sessionInfo = this.initializeSessionConfig(params); // Basic parameter validation using base class const requiredValidation = this.validateRequiredParams(params, ['caseID']); if (requiredValidation) { return requiredValidation; } // Additional comprehensive parameter validation for complex logic const validationResult = this.validateParameters(caseID, type); if (!validationResult.valid) { return { error: validationResult.error }; } // Normalize type parameter to handle case insensitivity const normalizedType = type.toLowerCase() === 'file' ? 'File' : 'URL'; // Execute with standardized error handling return await this.executeWithErrorHandling( `Attachment Categories: ${caseID} (${normalizedType})`, async () => await this.pegaClient.getCaseAttachmentCategories(caseID, { type: normalizedType }), { caseID, type: normalizedType, sessionInfo } ); } catch (error) { return { content: [{ type: 'text', text: `## Error: Attachment Categories\n\n**Unexpected Error**: ${error.message}\n\n${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*` }] }; } }
- Tool definition including name, description, and input schema for validation in MCP protocol.static getDefinition() { return { name: 'get_attachment_categories', description: 'Retrieve the list of attachment categories available for a specific Pega case, filtered by attachment type (File or URL). Returns category metadata including user permissions (view, create, edit, delete) for each attachment category associated with the case type. The API uses the class name from the caseID to get attachment categories and filters them based on the type parameter. Only attachment categories configured in the Attachment Category rule are returned. Useful for understanding what attachment categories are available and what operations the current user can perform on each category.', inputSchema: { type: 'object', properties: { caseID: { type: 'string', description: 'Case ID. Example: "MYORG-APP-WORK C-1001". Complete identifier including spaces."OSIEO3-DOCSAPP-WORK T-561003". The API uses the class name from this caseID to determine which attachment categories are associated with the case type.' }, type: { type: 'string', enum: ['File', 'URL', 'file', 'url'], description: 'Filter for the attachment type to retrieve categories for. Case insensitive. "File" or "file" returns all attachment categories of type File. "URL" or "url" returns attachment categories of type URL. Default value is "File". The API returns attachment categories of either type File or type URL during a particular API call, not both simultaneously.', default: 'File' }, sessionCredentials: getSessionCredentialsSchema() }, required: ['caseID'] } }; }
- src/registry/tool-loader.js:278-279 (registration)Dynamic registration via ToolLoader which scans tools directories, imports JS files, detects tool classes, validates, instantiates, and registers by name from getDefinition().export const toolLoader = new ToolLoader();