Set Default Journey
setDefaultJourneySet the default authentication journey for a realm, used when no specific journey is requested during authentication.
Instructions
Set the default authentication journey for a realm. This journey will be used when no specific journey is requested during authentication.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| realm | Yes | The realm to configure | |
| journeyName | Yes | The name of the journey to set as default |
Implementation Reference
- src/tools/am/setDefaultJourney.ts:15-66 (handler)The main tool definition and handler function for 'setDefaultJourney'. It exports setDefaultJourneyTool with name 'setDefaultJourney', defines input schema (realm and journeyName), and implements the logic: GET current auth config to preserve adminAuthModule, then PUT the updated config with the new default journey (orgConfig). Returns a success result or error.
export const setDefaultJourneyTool = { name: 'setDefaultJourney', title: 'Set Default Journey', description: 'Set the default authentication journey for a realm. This journey will be used when no specific journey is requested during authentication.', scopes: SCOPES, annotations: { destructiveHint: false, idempotentHint: true, openWorldHint: true }, inputSchema: { realm: z.enum(REALMS).describe('The realm to configure'), journeyName: safePathSegmentSchema.describe('The name of the journey to set as default') }, async toolFunction({ realm, journeyName }: { realm: string; journeyName: string }) { try { const authConfigUrl = buildAMRealmUrl(realm, 'realm-config/authentication'); // First, GET the current config to preserve adminAuthModule const { data: currentConfig } = await makeAuthenticatedRequest(authConfigUrl, SCOPES, { method: 'GET', headers: AUTH_CONFIG_HEADERS }); const configData = currentConfig as any; const adminAuthModule = configData?.core?.adminAuthModule || 'Login'; // PUT the updated config const { response } = await makeAuthenticatedRequest(authConfigUrl, SCOPES, { method: 'PUT', headers: AUTH_CONFIG_HEADERS, body: JSON.stringify({ orgConfig: journeyName, adminAuthModule: adminAuthModule }) }); const result = { success: true, realm, defaultJourney: journeyName, message: `Default journey for realm "${realm}" set to "${journeyName}"` }; return createToolResponse(formatSuccess(result, response)); } catch (error: any) { const category = categorizeError(error.message); return createToolResponse(`Failed to set default journey [${category}]: ${error.message}`); } } }; - Input schema for the setDefaultJourney tool: realm (enum of REALMS) and journeyName (safe path segment).
inputSchema: { realm: z.enum(REALMS).describe('The realm to configure'), journeyName: safePathSegmentSchema.describe('The name of the journey to set as default') }, - src/tools/am/index.ts:13-13 (registration)Re-exports setDefaultJourneyTool from the AM tools index, making it available for registration with the MCP server.
export { setDefaultJourneyTool } from './setDefaultJourney.js';