Check Delete Eligibility
check-delete-eligibilityCheck PowerPlatform component deletion eligibility. Returns whether deletion is allowed and lists blocking dependencies to prevent deletion errors.
Instructions
Check if a PowerPlatform component can be safely deleted. Returns whether deletion is allowed and lists blocking dependencies.
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 | ||
| canDelete | Yes | ||
| dependencies | Yes |
Implementation Reference
- src/services/dependency-service.ts:32-53 (handler)The actual handler implementation of checkDeleteEligibility that calls checkDependencies and determines if a component can be deleted based on whether it has dependencies
async checkDeleteEligibility( componentId: string, componentType: number ): Promise<{ canDelete: boolean; dependencies: unknown[] }> { try { const result = (await this.checkDependencies( componentId, componentType )) as { EntityCollection?: { Entities?: unknown[] } }; const dependencies = result.EntityCollection?.Entities || []; return { canDelete: dependencies.length === 0, dependencies: dependencies, }; } catch { return { canDelete: false, dependencies: [], }; } } - src/tools/dependency-tools.ts:55-104 (registration)Registration of the 'check-delete-eligibility' tool with MCP server including input/output schemas and async handler wrapper
// Check Delete Eligibility server.registerTool( "check-delete-eligibility", { title: "Check Delete Eligibility", description: "Check if a PowerPlatform component can be safely deleted. Returns whether deletion is allowed and lists blocking dependencies.", 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(), canDelete: z.boolean(), dependencies: z.array(z.any()), }), }, async ({ componentId, componentType, environment }) => { try { const ctx = registry.getContext(environment); const service = ctx.getDependencyService(); const result = await service.checkDeleteEligibility(componentId, componentType); const statusText = result.canDelete ? "✓ Component can be safely deleted (no dependencies found)" : `✗ Component cannot be deleted (${result.dependencies.length} dependencies found)`; return { structuredContent: { componentId, componentType, ...result }, content: [ { type: "text", text: `Delete eligibility for component '${componentId}' (type ${componentType}):\n\n${statusText}\n\nDependencies:\n${JSON.stringify(result.dependencies, null, 2)}`, }, ], }; } catch (error: any) { console.error("Error checking delete eligibility:", error); return { content: [ { type: "text", text: `Failed to check delete eligibility: ${error.message}`, }, ], }; } } ); - src/tools/dependency-tools.ts:58-72 (schema)Zod input and output schema definitions for the check-delete-eligibility tool
{ title: "Check Delete Eligibility", description: "Check if a PowerPlatform component can be safely deleted. Returns whether deletion is allowed and lists blocking dependencies.", 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(), canDelete: z.boolean(), dependencies: z.array(z.any()), }), },