Skip to main content
Glama
pingidentity

PingOne Advanced Identity Cloud MCP Server

Official
by pingidentity

Set Default Theme

setDefaultTheme
Idempotent

Set a theme as the default for a realm to apply consistent branding across the PingOne Advanced Identity Cloud environment.

Instructions

Set a theme as the default for a realm in PingOne AIC

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYesRealm name
themeIdentifierYesTheme ID or name

Implementation Reference

  • The main tool definition and handler for setDefaultTheme. Defines the tool name, input schema (realm, themeIdentifier), and the toolFunction that fetches the theme config, finds the theme by ID/name, sets all isDefault to false except the target, and PUTs the updated config back.
    export const setDefaultThemeTool = {
      name: 'setDefaultTheme',
      title: 'Set Default Theme',
      description: 'Set a theme as the default for a realm in PingOne AIC',
      scopes: SCOPES,
      annotations: {
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true
      },
      inputSchema: {
        realm: z.enum(REALMS).describe('Realm name'),
        themeIdentifier: safePathSegmentSchema.describe('Theme ID or name')
      },
      async toolFunction({ realm, themeIdentifier }: { realm: string; themeIdentifier: string }) {
        try {
          // Get the current theme configuration
          const configUrl = `https://${aicBaseUrl}/openidm/config/ui/themerealm`;
          const { data: config } = await makeAuthenticatedRequest(configUrl, SCOPES);
    
          // Validate config structure
          if (!config || !(config as any).realm || !(config as any).realm[realm]) {
            return createToolResponse(`Invalid theme configuration structure for realm "${realm}"`);
          }
    
          const realmThemes = (config as any).realm[realm];
    
          // Find the theme by ID or name
          const themeIndex = realmThemes.findIndex((t: any) => t._id === themeIdentifier || t.name === themeIdentifier);
    
          if (themeIndex === -1) {
            return createToolResponse(`Theme not found: "${themeIdentifier}" in realm "${realm}"`);
          }
    
          const targetTheme = realmThemes[themeIndex];
          const themeName = targetTheme.name;
          const themeId = targetTheme._id;
    
          // Check if it's already the default
          if (targetTheme.isDefault === true) {
            return createToolResponse(`Theme "${themeName}" is already the default theme for realm "${realm}"`);
          }
    
          // Set all themes to isDefault: false, then set target to true
          const updatedThemes = realmThemes.map((theme: any, index: number) => ({
            ...theme,
            isDefault: index === themeIndex
          }));
    
          // Update the config
          const updatedConfig = {
            ...config,
            realm: {
              ...(config as any).realm,
              [realm]: updatedThemes
            }
          };
    
          // PUT the updated configuration back
          const { response } = await makeAuthenticatedRequest(configUrl, SCOPES, {
            method: 'PUT',
            body: JSON.stringify(updatedConfig)
          });
    
          const successMessage = `Set theme "${themeName}" (${themeId}) as default for realm "${realm}"`;
          return createToolResponse(
            formatSuccess({ _id: themeId, name: themeName, isDefault: true, message: successMessage }, response)
          );
        } catch (error: any) {
          return createToolResponse(`Failed to set default theme in realm "${realm}": ${error.message}`);
        }
      }
    };
  • Input schema for the setDefaultTheme tool: realm (from enum REALMS) and themeIdentifier (safe path segment).
    inputSchema: {
      realm: z.enum(REALMS).describe('Realm name'),
      themeIdentifier: safePathSegmentSchema.describe('Theme ID or name')
    },
  • Re-exports the setDefaultThemeTool from setDefaultTheme.ts as part of the theme tools index.
    export { setDefaultThemeTool } from './setDefaultTheme.js';
  • Guard in updateTheme that prevents updating isDefault directly and directs users to use setDefaultTheme instead.
    if ('isDefault' in themeUpdates) {
      return createToolResponse(
        'Cannot update "isDefault" directly. Use the setDefaultTheme tool to change the default theme.'
      );
  • Guard in deleteTheme that prevents deleting the default theme and directs users to use setDefaultTheme first.
    if (themeToDelete.isDefault === true) {
      return createToolResponse(
        `Cannot delete the default theme "${themeName}". ` +
          `Set another theme as default using the setDefaultTheme tool first, then delete this theme.`
      );
Behavior3/5

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

Annotations already indicate idempotent, non-destructive, open-world behavior. The description adds no further context about side effects or state changes beyond the basic action.

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?

Single concise sentence, front-loaded, with no wasted words.

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?

Adequate for a simple set operation, but lacks mention that the theme must already exist, that it overwrites the previous default, or any return value details.

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% with descriptions for both parameters; the tool description does not add further meaning or clarification beyond what the schema provides.

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?

Clearly states 'set a theme as the default for a realm' with a specific verb and resource, distinguishing it from sibling tools like createTheme or updateTheme.

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?

Implies that this tool is for setting a default theme, but provides no explicit guidance on when to use it vs alternatives like setDefaultJourney, nor prerequisites 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