Check Component Dependencies
check-component-dependenciesIdentify dependent components before deleting PowerPlatform elements to prevent breaking changes. Returns all dependent items to ensure safe removal from Dataverse environments.
Instructions
Check dependencies for a PowerPlatform component before deletion. Returns all components that depend on the specified component.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| componentId | Yes | The GUID of the component to check | |
| componentType | Yes | The component type number (e.g., 1=Entity, 9=OptionSet, 29=Workflow, 80=PluginAssembly, 90=PluginType, 92=SdkMessageProcessingStep) | |
| environment | No | Environment name (e.g. DEV, UAT). Uses default if omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| componentId | Yes | ||
| componentType | Yes | ||
| dependencies | Yes |
Implementation Reference
- src/tools/dependency-tools.ts:26-52 (handler)The async handler function that executes the check-component-dependencies tool logic. It retrieves the dependency service from the registry and calls checkDependencies() with the provided componentId and componentType, then returns formatted results.
async ({ componentId, componentType, environment }) => { try { const ctx = registry.getContext(environment); const service = ctx.getDependencyService(); const dependencies = await service.checkDependencies(componentId, componentType); return { structuredContent: { componentId, componentType, dependencies }, content: [ { type: "text", text: `Dependencies for component '${componentId}' (type ${componentType}):\n\n${JSON.stringify(dependencies, null, 2)}`, }, ], }; } catch (error: any) { console.error("Error checking component dependencies:", error); return { content: [ { type: "text", text: `Failed to check component dependencies: ${error.message}`, }, ], }; } } - src/tools/dependency-tools.ts:12-25 (schema)Input/output schema definition for the check-component-dependencies tool. Defines componentId (string), componentType (number), and optional environment parameters using Zod validation.
{ title: "Check Component Dependencies", description: "Check dependencies for a PowerPlatform component before deletion. Returns all components that depend on the specified component.", inputSchema: { componentId: z.string().describe("The GUID of the component to check"), componentType: z.number().describe("The component type number (e.g., 1=Entity, 9=OptionSet, 29=Workflow, 80=PluginAssembly, 90=PluginType, 92=SdkMessageProcessingStep)"), environment: z.string().optional().describe("Environment name (e.g. DEV, UAT). Uses default if omitted."), }, outputSchema: z.object({ componentId: z.string(), componentType: z.number(), dependencies: z.any(), }), }, - src/tools/dependency-tools.ts:10-53 (registration)Registration of the check-component-dependencies tool with the MCP server. Includes the tool name, schema configuration, and handler function binding.
server.registerTool( "check-component-dependencies", { title: "Check Component Dependencies", description: "Check dependencies for a PowerPlatform component before deletion. Returns all components that depend on the specified component.", inputSchema: { componentId: z.string().describe("The GUID of the component to check"), componentType: z.number().describe("The component type number (e.g., 1=Entity, 9=OptionSet, 29=Workflow, 80=PluginAssembly, 90=PluginType, 92=SdkMessageProcessingStep)"), environment: z.string().optional().describe("Environment name (e.g. DEV, UAT). Uses default if omitted."), }, outputSchema: z.object({ componentId: z.string(), componentType: z.number(), dependencies: z.any(), }), }, async ({ componentId, componentType, environment }) => { try { const ctx = registry.getContext(environment); const service = ctx.getDependencyService(); const dependencies = await service.checkDependencies(componentId, componentType); return { structuredContent: { componentId, componentType, dependencies }, content: [ { type: "text", text: `Dependencies for component '${componentId}' (type ${componentType}):\n\n${JSON.stringify(dependencies, null, 2)}`, }, ], }; } catch (error: any) { console.error("Error checking component dependencies:", error); return { content: [ { type: "text", text: `Failed to check component dependencies: ${error.message}`, }, ], }; } } ); - Core implementation of the checkDependencies method in DependencyService. Makes the actual API call to PowerPlatform's RetrieveDependenciesForDelete endpoint using the PowerPlatformClient.
async checkDependencies( componentId: string, componentType: number ): Promise<unknown> { return this.client.post( 'api/data/v9.2/RetrieveDependenciesForDelete', { ObjectId: componentId, ComponentType: componentType, } ); }