Skip to main content
Glama
DynamicEndpoints

Microsoft 365 Core MCP Server

manage_intune_windows_devices

Destructive

Manage Windows devices in Microsoft Intune by enrolling, configuring, and performing actions like wiping, restarting, or collecting logs to maintain device health and security.

Instructions

Manage Windows devices in Intune including enrollment, autopilot deployment, device actions, and health monitoring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesIntune Windows device management action
deviceIdNoDevice ID for device-specific operations
filterNoOData filter for device listing
enrollmentTypeNoWindows enrollment type
assignmentTargetNoAssignment target
bitlockerSettingsNoBitLocker configuration

Implementation Reference

  • Core handler function implementing the manage_intune_windows_devices tool. Handles device actions like listing, getting details, enrollment, retirement, wiping, restarting, syncing, locking, log collection, BitLocker recovery, and Autopilot reset using Microsoft Graph API endpoints under /deviceManagement/managedDevices.
    export async function handleIntuneWindowsDevices(
      graphClient: Client,
      args: IntuneWindowsDeviceArgs
    ): Promise<{ content: { type: string; text: string }[] }> {
      // Create Intune-specific client for proper authentication
      const intuneClient = createIntuneGraphClient(graphClient);
      let apiPath = '';
      let result: any;
    
      switch (args.action) {
        case 'list':
          // List all Windows devices managed by Intune
          apiPath = '/deviceManagement/managedDevices';
          const queryOptions: string[] = [];
          
          // Filter for Windows devices
          queryOptions.push(`$filter=operatingSystem eq 'Windows'`);
          
          if (args.filter) {
            queryOptions.push(`and ${args.filter}`);
          }
    
          if (queryOptions.length > 0) {
            apiPath += `?${queryOptions.join('')}`;
          }
    
          result = (await intuneClient.makeApiCall(apiPath)).data;
          break;
    
        case 'get':
          if (!args.deviceId) {
            throw new McpError(ErrorCode.InvalidParams, 'deviceId is required for get action');
          }
          apiPath = `/deviceManagement/managedDevices/${args.deviceId}`;
          result = await graphClient.api(apiPath).get();
          break;
    
        case 'enroll':
          // Create enrollment invitation for Windows devices
          apiPath = '/deviceManagement/deviceEnrollmentConfigurations';
          const enrollmentPayload = {
            displayName: 'Windows Device Enrollment',
            description: 'Automated Windows device enrollment',
            deviceEnrollmentConfigurationType: 'windows10EnrollmentCompletionPageConfiguration',
            priority: 0,
            showInstallationProgress: true,
            blockDeviceSetupRetryByUser: false,
            allowDeviceResetOnInstallFailure: true,
            allowLogCollectionOnInstallFailure: true,
            customErrorMessage: 'Setup could not be completed. Please try again or contact your support person for help.',
            installProgressTimeoutInMinutes: 60,
            allowDeviceUseOnInstallFailure: true,
            selectedMobileAppIds: [],
            trackInstallProgressForAutopilotOnly: false,
            disableUserStatusTrackingAfterFirstUser: true
          };
    
          if (args.enrollmentType) {
            enrollmentPayload.deviceEnrollmentConfigurationType = 
              args.enrollmentType === 'AzureADJoin' ? 'azureADJoinUsingBulkEnrollment' :
              args.enrollmentType === 'HybridAzureADJoin' ? 'hybridAzureADJoin' :
              'windows10EnrollmentCompletionPageConfiguration';
          }
    
          result = await graphClient.api(apiPath).post(enrollmentPayload);
          break;
    
        case 'retire':
          if (!args.deviceId) {
            throw new McpError(ErrorCode.InvalidParams, 'deviceId is required for retire action');
          }
          apiPath = `/deviceManagement/managedDevices/${args.deviceId}/retire`;
          result = await graphClient.api(apiPath).post({
            keepEnrollmentData: false,
            keepUserData: true
          });
          break;
    
        case 'wipe':
          if (!args.deviceId) {
            throw new McpError(ErrorCode.InvalidParams, 'deviceId is required for wipe action');
          }
          apiPath = `/deviceManagement/managedDevices/${args.deviceId}/wipe`;
          result = await graphClient.api(apiPath).post({
            keepEnrollmentData: false,
            keepUserData: false,
            useProtectedWipe: true
          });
          break;
    
        case 'restart':
          if (!args.deviceId) {
            throw new McpError(ErrorCode.InvalidParams, 'deviceId is required for restart action');
          }
          apiPath = `/deviceManagement/managedDevices/${args.deviceId}/rebootNow`;
          result = await graphClient.api(apiPath).post({});
          break;
    
        case 'sync':
          if (!args.deviceId) {
            throw new McpError(ErrorCode.InvalidParams, 'deviceId is required for sync action');
          }
          apiPath = `/deviceManagement/managedDevices/${args.deviceId}/syncDevice`;
          result = await graphClient.api(apiPath).post({});
          break;
    
        case 'remote_lock':
          if (!args.deviceId) {
            throw new McpError(ErrorCode.InvalidParams, 'deviceId is required for remote_lock action');
          }
          apiPath = `/deviceManagement/managedDevices/${args.deviceId}/remoteLock`;
          result = await graphClient.api(apiPath).post({});
          break;
    
        case 'collect_logs':
          if (!args.deviceId) {
            throw new McpError(ErrorCode.InvalidParams, 'deviceId is required for collect_logs action');
          }
          apiPath = `/deviceManagement/managedDevices/${args.deviceId}/createDeviceLogCollectionRequest`;
          result = await graphClient.api(apiPath).post({
            templateType: 'predefined'
          });
          break;    case 'bitlocker_recovery':
          if (!args.deviceId) {
            throw new McpError(ErrorCode.InvalidParams, 'deviceId is required for bitlocker_recovery action');
          }
          apiPath = `/informationProtection/bitlocker/recoveryKeys`;
          const filter = `$filter=deviceId eq '${args.deviceId}'`;
          result = await graphClient.api(`${apiPath}?${filter}`).get();
          break;
    
        case 'autopilot_reset':
          if (!args.deviceId) {
            throw new McpError(ErrorCode.InvalidParams, 'deviceId is required for autopilot_reset action');
          }
          apiPath = `/deviceManagement/managedDevices/${args.deviceId}/autopilotReset`;
          result = await graphClient.api(apiPath).post({
            keepUserData: false
          });
          break;
    
        default:
          throw new McpError(ErrorCode.InvalidParams, `Unknown action: ${args.action}`);
      }
    
      return {
        content: [
          {
            type: 'text',
            text: `Windows Device Management Result:\n${JSON.stringify(result, null, 2)}`
          }
        ]
      };
    }
  • TypeScript interface defining input arguments for the Intune Windows device management handler, including action type and parameters for specific operations.
    export interface IntuneWindowsDeviceArgs {
      action: 'list' | 'get' | 'enroll' | 'retire' | 'wipe' | 'restart' | 'sync' | 'remote_lock' | 'collect_logs' | 'bitlocker_recovery' | 'autopilot_reset';
      deviceId?: string;
      filter?: string;
      enrollmentType?: 'AzureADJoin' | 'HybridAzureADJoin' | 'AutoPilot' | 'BulkEnrollment';
      assignmentTarget?: {
        groupIds?: string[];
        userIds?: string[];
        deviceIds?: string[];
      };
      bitlockerSettings?: {
        requireBitlockerEncryption?: boolean;
        allowBitlockerRecoveryKeyBackup?: boolean;
      };
    }
  • Zod schema used for input validation and MCP tool schema definition for the manage_intune_windows_devices tool.
    export const intuneWindowsDeviceSchema = z.object({
      action: z.enum(['list', 'get', 'enroll', 'retire', 'wipe', 'restart', 'sync', 'remote_lock', 'collect_logs', 'bitlocker_recovery', 'autopilot_reset']).describe('Intune Windows device management action'),
      deviceId: z.string().optional().describe('Device ID for device-specific operations'),
      filter: z.string().optional().describe('OData filter for device listing'),
      enrollmentType: z.enum(['AzureADJoin', 'HybridAzureADJoin', 'AutoPilot', 'BulkEnrollment']).optional().describe('Windows enrollment type'),
      assignmentTarget: z.object({
        groupIds: z.array(z.string()).optional().describe('Target group IDs'),
        userIds: z.array(z.string()).optional().describe('Target user IDs'),
        deviceIds: z.array(z.string()).optional().describe('Target device IDs'),
      }).optional().describe('Assignment target'),
      bitlockerSettings: z.object({
        requireBitlockerEncryption: z.boolean().optional().describe('Require BitLocker encryption'),
        allowBitlockerRecoveryKeyBackup: z.boolean().optional().describe('Allow recovery key backup'),
      }).optional().describe('BitLocker configuration'),
    });
  • Tool metadata registration providing description, title, and behavioral annotations (readOnlyHint, destructiveHint, etc.) for the manage_intune_windows_devices tool.
    manage_intune_windows_devices: {
      description: "Manage Windows devices in Intune including enrollment, autopilot deployment, device actions, and health monitoring.",
      title: "Intune Windows Device Manager",
      annotations: { title: "Intune Windows Device Manager", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }
  • Tool schema registration in the central m365CoreTools object, mapping 'intuneWindowsDevices' schema to the tool registry.
      intuneMacOSCompliance: intuneMacOSComplianceSchema,
      intuneWindowsDevices: intuneWindowsDeviceSchema,
      intuneWindowsPolicies: intuneWindowsPolicySchema,
      intuneWindowsApps: intuneWindowsAppSchema,
      intuneWindowsCompliance: intuneWindowsComplianceSchema,
      complianceFrameworks: complianceFrameworkSchema,
      complianceAssessments: complianceAssessmentSchema,
      complianceMonitoring: complianceMonitoringSchema,
      evidenceCollection: evidenceCollectionSchema,
      gapAnalysis: gapAnalysisSchema,
      auditReports: auditReportSchema,
      cisCompliance: cisComplianceSchema,
    } as const;
Behavior3/5

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

Annotations already indicate this is a destructive, non-idempotent, non-read-only tool. The description adds some behavioral context by listing action types like 'wipe' and 'retire' that align with the destructive hint, but doesn't provide additional details about rate limits, authentication requirements, or specific destructive consequences. It doesn't contradict annotations, but adds only moderate value beyond them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It lists key action types without unnecessary elaboration. While it could be slightly more structured (e.g., separating read vs. write actions), it avoids redundancy and stays focused on the tool's scope.

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?

For a complex tool with 6 parameters, destructive annotations, and no output schema, the description is minimally adequate. It covers the broad scope but lacks details on error conditions, response formats, or operational constraints. Given the richness of the schema and annotations, the description provides basic context but leaves gaps in guiding effective use.

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?

With 100% schema description coverage, the schema fully documents all 6 parameters. The description mentions 'enrollment' and 'autopilot deployment' which map to the 'action' and 'enrollmentType' parameters, but adds no meaningful semantic context beyond what the schema already provides. The baseline score of 3 reflects adequate but unenhanced parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Manage Windows devices in Intune' with specific actions listed (enrollment, autopilot deployment, device actions, health monitoring). It uses a strong verb ('manage') and identifies the resource ('Windows devices in Intune'), but doesn't explicitly differentiate from sibling tools like 'manage_intune_macos_devices' or 'manage_azure_ad_devices' beyond the 'Windows' qualifier.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, appropriate contexts, or exclusions. While it lists action types, it offers no help in choosing between this tool and sibling tools like 'manage_intune_macos_devices' or 'manage_azure_ad_devices' for similar management tasks on different platforms.

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/DynamicEndpoints/m365-core-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server