Skip to main content
Glama
marco-looy

Pega DX MCP Server

by marco-looy

get_document

Retrieve document content as base64 encoded string by providing a document ID. Validates access permissions before returning the encoded content from the Pega system.

Instructions

Get contents of a document as base64 encoded string. Downloads document content based on the documentID parameter. The API validates the documentID and checks if the user has access to view the document before returning the base64 encoded content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentIDYesDocument ID to retrieve content for. This is the unique identifier that identifies the specific document in the Pega system. The document must exist and be accessible to the current user.
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

  • Defines the tool schema, name, description, and input schema requiring documentID for the get_document tool.
    static getDefinition() {
      return {
        name: 'get_document',
        description: 'Get contents of a document as base64 encoded string. Downloads document content based on the documentID parameter. The API validates the documentID and checks if the user has access to view the document before returning the base64 encoded content.',
        inputSchema: {
          type: 'object',
          properties: {
            documentID: {
              type: 'string',
              description: 'Document ID to retrieve content for. This is the unique identifier that identifies the specific document in the Pega system. The document must exist and be accessible to the current user.'
            },
            sessionCredentials: getSessionCredentialsSchema()
          },
          required: ['documentID']
        }
      };
    }
  • The execute method is the main handler for the get_document tool. It performs parameter validation, session initialization, and calls the pegaClient to retrieve the document content, with comprehensive error handling.
    async execute(params) {
      const { documentID } = params;
      let sessionInfo = null;
    
      try {
        sessionInfo = this.initializeSessionConfig(params);
    
        // Basic parameter validation using base class
        const requiredValidation = this.validateRequiredParams(params, ['documentID']);
        if (requiredValidation) {
          return requiredValidation;
        }
    
        // Additional comprehensive parameter validation
        const validationResult = this.validateParameters(documentID);
        if (!validationResult.valid) {
          return {
            error: validationResult.error
          };
        }
    
        // Execute with standardized error handling
        return await this.executeWithErrorHandling(
          `Document Content: ${documentID}`,
          async () => await this.pegaClient.getDocumentContent(documentID),
          { documentID, sessionInfo }
        );
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `## Error: Document Content: ${documentID}\n\n**Unexpected Error**: ${error.message}\n\n${sessionInfo ? `**Session**: ${sessionInfo.sessionId} (${sessionInfo.authMode} mode)\n` : ''}*Error occurred at: ${new Date().toISOString()}*`
          }]
        };
      }
    }
  • Helper method in PegaClient wrapper that delegates to the underlying client to fetch document content by ID.
    async getDocumentContent(documentID) {
      return this.client.getDocumentContent(documentID);
    }
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 behaviors: it performs validation ('API validates the documentID'), checks permissions ('checks if the user has access'), and describes the return format ('base64 encoded content'). It doesn't mention rate limits, caching, or error behaviors, but covers essential operational aspects.

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 appropriately sized with three clear sentences that each add value: purpose statement, parameter mention, and behavioral details. It's front-loaded with the core functionality and avoids unnecessary repetition. Could be slightly more concise by combining some elements, but overall efficient.

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

Completeness3/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 output schema and no annotations, the description adequately covers purpose, basic behavior, and authentication context. However, it lacks details about response format beyond 'base64 encoded string' (e.g., metadata, error responses) and doesn't mention performance characteristics or limitations that would help an agent use it 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?

With 100% schema description coverage, the baseline is 3. The description adds minimal parameter semantics beyond the schema, mentioning only that 'documentID parameter' is used for downloading content. It doesn't provide additional context about parameter interactions or usage nuances that aren't already in the detailed schema descriptions.

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 contents of a document'), resource ('document'), and output format ('as base64 encoded string'), distinguishing it from sibling tools like 'get_attachment' or 'get_case' that retrieve different resources. It precisely defines what the tool does without being tautological.

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 by mentioning validation and access checks, but doesn't explicitly state when to use this tool versus alternatives like 'get_attachment' or 'get_case_attachments'. It provides some context about prerequisites (valid documentID, user access) but lacks explicit guidance on tool selection among siblings.

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