List Managed Objects
listManagedObjectsRetrieve all managed object types available in PingOne Advanced Identity Cloud.
Instructions
Retrieve the list of all managed object types available in PingOne AIC
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main implementation of the 'listManagedObjects' tool. It defines the tool object with name, title, description, scopes, annotations, inputSchema (empty), and a toolFunction that calls the PingOne AIC API endpoint /openidm/config/managed, extracts object names from the response, and returns them as a JSON string.
import { makeAuthenticatedRequest, createToolResponse } from '../../utils/apiHelpers.js'; const aicBaseUrl = process.env.AIC_BASE_URL; const SCOPES = ['fr:idm:*']; export const listManagedObjectsTool = { name: 'listManagedObjects', title: 'List Managed Objects', description: 'Retrieve the list of all managed object types available in PingOne AIC', scopes: SCOPES, annotations: { readOnlyHint: true, openWorldHint: true }, inputSchema: { // No parameters needed }, async toolFunction() { const url = `https://${aicBaseUrl}/openidm/config/managed`; try { const { data } = await makeAuthenticatedRequest(url, SCOPES); const config = data as any; // Extract just the names const objectNames = (config.objects || []).map((obj: any) => obj.name); return createToolResponse(JSON.stringify({ managedObjectTypes: objectNames }, null, 2)); } catch (error: any) { return createToolResponse(`Error listing managed objects: ${error.message}`); } } }; - Input schema for listManagedObjects — empty object since no parameters are needed.
inputSchema: { // No parameters needed }, - src/index.ts:27-44 (registration)The tool registration loop in src/index.ts. All tools (including listManagedObjects) are registered with the MCP server via server.registerTool(tool.name, toolConfig, tool.toolFunction).
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); }); - src/utils/toolHelpers.ts:15-33 (registration)getAllTools() collects listManagedObjectsTool (via managedObjectTools namespace) and all other tools, which are then registered in src/index.ts.
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; } - src/utils/apiHelpers.ts:14-42 (helper)makeAuthenticatedRequest utility used by the handler to make authenticated API calls to PingOne AIC.
export async function makeAuthenticatedRequest( url: string, scopes: string[], options: RequestInit = {} ): Promise<{ data: unknown; response: Response }> { const token = await getAuthService().getToken(scopes); const response = await fetch(url, { ...options, headers: { Authorization: `Bearer ${token}`, 'User-Agent': USER_AGENT, // Only add Content-Type header if the request has a body ...(options.body && { 'Content-Type': 'application/json' }), ...options.headers } }); if (!response.ok) { const errorBody = await response.text(); throw new Error(formatError(response, errorBody)); } // Handle empty responses (e.g., 204 No Content or DELETE operations) const contentLength = response.headers.get('content-length'); const data = response.status === 204 || contentLength === '0' ? null : await response.json(); return { data, response }; }