Skip to main content
Glama
pingidentity

PingOne Advanced Identity Cloud MCP Server

Official
by pingidentity

Get Environment Variable (ESV)

getVariable
Read-only

Retrieve a specific environment variable (ESV) from PingOne Advanced Identity Cloud by its ID and return the decoded value.

Instructions

Retrieve a specific environment variable (ESV) by ID with decoded value

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variableIdYesVariable ID (format: esv-*)

Implementation Reference

  • The main handler function 'toolFunction' that retrieves an environment variable by ID from the AIC API. It makes an authenticated request to /environment/variables/{variableId}, decodes the base64 value, and returns the result.
      async toolFunction({ variableId }: { variableId: string }) {
        try {
          const url = `https://${aicBaseUrl}/environment/variables/${variableId}`;
    
          const { data, response } = await makeAuthenticatedRequest(url, SCOPES, {
            headers: {
              'accept-api-version': 'resource=2.0'
            }
          });
    
          // Decode the base64 value and replace the field
          const variableData = data as any;
          if (variableData.valueBase64) {
            const decodedValue = Buffer.from(variableData.valueBase64, 'base64').toString('utf-8');
            delete variableData.valueBase64;
            variableData.value = decodedValue;
          }
    
          return createToolResponse(formatSuccess(variableData, response));
        } catch (error: any) {
          return createToolResponse(`Failed to get variable '${variableId}': ${error.message}`);
        }
      }
    };
  • Input schema validation for the getVariable tool. Expects a 'variableId' parameter validated by safePathSegmentSchema (format: esv-*).
    inputSchema: {
      variableId: safePathSegmentSchema.describe('Variable ID (format: esv-*)')
    },
  • src/index.ts:27-43 (registration)
    Tool registration loop where getVariableTool (along with all other tools) is registered with the MCP server via server.registerTool().
    allTools.forEach((tool) => {
      const toolConfig: ToolConfig = {
        title: tool.title,
        description: tool.description
      };
    
      // Only add inputSchema if it exists (some tools like getLogSources don't have one)
      if ('inputSchema' in tool && tool.inputSchema) {
        toolConfig.inputSchema = tool.inputSchema;
      }
    
      // Add annotations if present
      if ('annotations' in tool && tool.annotations) {
        toolConfig.annotations = tool.annotations;
      }
    
      server.registerTool(tool.name, toolConfig, tool.toolFunction as any);
  • getAllTools() function that collects all tool objects including getVariableTool from the esvTool module and returns them for registration.
    export function getAllTools(): Tool[] {
      const isDockerMode = process.env.DOCKER_CONTAINER === 'true';
    
      const tools: Tool[] = [
        ...(Object.values(managedObjectTools) as Tool[]),
        ...(Object.values(logTools) as Tool[]),
        ...(Object.values(themeTools) as Tool[]),
        ...(Object.values(esvTools) as Tool[]),
        ...(Object.values(featureManagementTools) as Tool[])
      ];
    
      // Only include AM tools in non-Docker mode (requires browser-based PKCE auth)
      if (!isDockerMode) {
        tools.push(...(Object.values(amTools) as Tool[]));
        tools.push(...(Object.values(applicationTools) as Tool[]));
      }
    
      return tools;
    }
  • The full getVariable.ts file containing the complete getVariable tool definition including imports, tool object with name/title/description/scopes/annotations, input schema, and handler function.
    import { makeAuthenticatedRequest, createToolResponse } from '../../utils/apiHelpers.js';
    import { formatSuccess } from '../../utils/responseHelpers.js';
    import { safePathSegmentSchema } from '../../utils/validationHelpers.js';
    
    const aicBaseUrl = process.env.AIC_BASE_URL;
    
    const SCOPES = ['fr:idc:esv:read'];
    
    export const getVariableTool = {
      name: 'getVariable',
      title: 'Get Environment Variable (ESV)',
      description: 'Retrieve a specific environment variable (ESV) by ID with decoded value',
      scopes: SCOPES,
      annotations: {
        readOnlyHint: true,
        openWorldHint: true
      },
      inputSchema: {
        variableId: safePathSegmentSchema.describe('Variable ID (format: esv-*)')
      },
      async toolFunction({ variableId }: { variableId: string }) {
        try {
          const url = `https://${aicBaseUrl}/environment/variables/${variableId}`;
    
          const { data, response } = await makeAuthenticatedRequest(url, SCOPES, {
            headers: {
              'accept-api-version': 'resource=2.0'
            }
          });
    
          // Decode the base64 value and replace the field
          const variableData = data as any;
          if (variableData.valueBase64) {
            const decodedValue = Buffer.from(variableData.valueBase64, 'base64').toString('utf-8');
            delete variableData.valueBase64;
            variableData.value = decodedValue;
          }
    
          return createToolResponse(formatSuccess(variableData, response));
        } catch (error: any) {
          return createToolResponse(`Failed to get variable '${variableId}': ${error.message}`);
        }
      }
    };
Behavior3/5

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

Annotations already declare readOnlyHint and openWorldHint. The description adds minor behavioral detail ('decoded value') but does not elaborate on error handling, idempotency, or other traits.

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?

The description is a single, concise sentence with no extraneous information. It is front-loaded with the verb and resource.

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?

Without an output schema, the description should explain the return value more clearly. It only mentions 'decoded value' but does not specify format or structure. Error conditions are not addressed.

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 coverage is 100% and already describes the required parameter (variableId) adequately. The description adds no further semantic meaning beyond restating that retrieval is by ID.

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 action ('Retrieve'), the resource ('environment variable (ESV)'), the method ('by ID'), and adds specificity ('with decoded value'). It distinguishes from sibling tools like queryESVs (list/search) and setVariable (write).

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

Usage Guidelines2/5

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

The description lacks any guidance on when to use this tool versus alternatives such as queryESVs or setVariable. There is no mention of prerequisites, context, or exclusions.

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/pingidentity/aic-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server