Skip to main content
Glama
DynamicEndpoints

Microsoft 365 Core MCP Server

manage_security_alert_policies

Destructive

Configure and manage security alert policies to monitor threats, suspicious activities, and compliance violations across Microsoft 365 services.

Instructions

Manage security alert policies for monitoring threats, suspicious activities, and compliance violations across Microsoft 365.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform on security alert policy
policyIdNoSecurity alert policy ID for specific operations
displayNameNoDisplay name for the policy
descriptionNoDescription of the policy
categoryNoAlert category
severityNoAlert severity
isEnabledNoWhether the policy is enabled
conditionsNoAlert conditions
actionsNoAlert actions

Implementation Reference

  • The core handler function implementing CRUD (list, get, create, update, delete) and toggle (enable/disable) operations for security alert policies using Microsoft Graph API /security/alerts/policies endpoint. Handles validation, API calls, and response formatting.
    export async function handleSecurityAlertPolicies(
      graphClient: Client,
      args: SecurityAlertPolicyArgs
    ): Promise<{ content: { type: string; text: string }[] }> {
      let apiPath = '';
      let result: any;
    
      switch (args.action) {
        case 'list':
          apiPath = '/security/alerts/policies';
          result = await graphClient.api(apiPath).get();
          break;
    
        case 'get':
          if (!args.policyId) {
            throw new McpError(ErrorCode.InvalidParams, 'policyId is required for get action');
          }
          apiPath = `/security/alerts/policies/${args.policyId}`;
          result = await graphClient.api(apiPath).get();
          break;
    
        case 'create':
          if (!args.displayName) {
            throw new McpError(ErrorCode.InvalidParams, 'displayName is required for create action');
          }
          
          const alertPolicyPayload: any = {
            displayName: args.displayName,
            description: args.description || '',
            category: args.category || 'Others',
            severity: args.severity || 'Medium',
            isEnabled: args.isEnabled !== undefined ? args.isEnabled : true,
            conditions: args.conditions || {},
            actions: args.actions || {}
          };
    
          apiPath = '/security/alerts/policies';
          result = await graphClient.api(apiPath).post(alertPolicyPayload);
          break;
    
        case 'update':
          if (!args.policyId) {
            throw new McpError(ErrorCode.InvalidParams, 'policyId is required for update action');
          }
    
          const updatePayload: any = {};
          if (args.displayName) updatePayload.displayName = args.displayName;
          if (args.description) updatePayload.description = args.description;
          if (args.category) updatePayload.category = args.category;
          if (args.severity) updatePayload.severity = args.severity;
          if (args.isEnabled !== undefined) updatePayload.isEnabled = args.isEnabled;
          if (args.conditions) updatePayload.conditions = args.conditions;
          if (args.actions) updatePayload.actions = args.actions;
    
          apiPath = `/security/alerts/policies/${args.policyId}`;
          result = await graphClient.api(apiPath).patch(updatePayload);
          break;
    
        case 'delete':
          if (!args.policyId) {
            throw new McpError(ErrorCode.InvalidParams, 'policyId is required for delete action');
          }
          apiPath = `/security/alerts/policies/${args.policyId}`;
          await graphClient.api(apiPath).delete();
          result = { message: `Security alert policy ${args.policyId} deleted successfully` };
          break;
    
        case 'enable':
          if (!args.policyId) {
            throw new McpError(ErrorCode.InvalidParams, 'policyId is required for enable action');
          }
          apiPath = `/security/alerts/policies/${args.policyId}`;
          result = await graphClient.api(apiPath).patch({ isEnabled: true });
          break;
    
        case 'disable':
          if (!args.policyId) {
            throw new McpError(ErrorCode.InvalidParams, 'policyId is required for disable action');
          }
          apiPath = `/security/alerts/policies/${args.policyId}`;
          result = await graphClient.api(apiPath).patch({ isEnabled: false });
          break;
    
        default:
          throw new McpError(ErrorCode.InvalidParams, `Unknown action: ${args.action}`);
      }
    
      return {
        content: [{
          type: 'text',
          text: `Security Alert Policy ${args.action} operation completed:\n\n${JSON.stringify(result, null, 2)}`
        }]
      };
    }
  • Zod schema (securityAlertPolicyArgsSchema) defining input validation and structure for the tool's arguments, including action types, policy details, conditions, and actions.
    export const securityAlertPolicyArgsSchema = z.object({
      action: z.enum(['list', 'get', 'create', 'update', 'delete', 'enable', 'disable']).describe('Action to perform on security alert policy'),
      policyId: z.string().optional().describe('Security alert policy ID for specific operations'),
      displayName: z.string().optional().describe('Display name for the policy'),
      description: z.string().optional().describe('Description of the policy'),
      category: z.enum(['DataLossPrevention', 'ThreatManagement', 'DataGovernance', 'AccessGovernance', 'Others']).optional().describe('Alert category'),
      severity: z.enum(['Low', 'Medium', 'High', 'Informational']).optional().describe('Alert severity'),
      isEnabled: z.boolean().optional().describe('Whether the policy is enabled'),
      conditions: z.object({
        activityType: z.string().optional().describe('Activity type to monitor'),
        objectType: z.string().optional().describe('Object type to monitor'),
        userType: z.enum(['Admin', 'Regular', 'Guest', 'System']).optional().describe('User type to monitor'),
        locationFilter: z.array(z.string()).optional().describe('Location filters'),
        timeRange: z.object({
          startTime: z.string().describe('Start time'),
          endTime: z.string().describe('End time'),
        }).optional().describe('Time range for alerts'),
      }).optional().describe('Alert conditions'),
      actions: z.object({
        notifyUsers: z.array(z.string()).optional().describe('Users to notify'),
        escalateToAdmin: z.boolean().optional().describe('Escalate to admin'),
        suppressRecurringAlerts: z.boolean().optional().describe('Suppress recurring alerts'),
        threshold: z.object({
          value: z.number().describe('Threshold value'),
          timeWindow: z.number().describe('Time window in minutes'),
        }).optional().describe('Alert threshold'),
      }).optional().describe('Alert actions'),
    });
  • TypeScript interface (SecurityAlertPolicyArgs) defining the structure of arguments passed to the handler function.
    export interface SecurityAlertPolicyArgs {
      action: 'list' | 'get' | 'create' | 'update' | 'delete' | 'enable' | 'disable';
      policyId?: string;
      displayName?: string;
      description?: string;
      category?: 'DataLossPrevention' | 'ThreatManagement' | 'DataGovernance' | 'AccessGovernance' | 'Others';
      severity?: 'Low' | 'Medium' | 'High' | 'Informational';
      isEnabled?: boolean;
      conditions?: {
        activityType?: string;
        objectType?: string;
        userType?: 'Admin' | 'Regular' | 'Guest' | 'System';
        locationFilter?: string[];
        timeRange?: {
          startTime: string;
          endTime: string;
        };
      };
      actions?: {
        notifyUsers?: string[];
        escalateToAdmin?: boolean;
        suppressRecurringAlerts?: boolean;
        threshold?: {
          value: number;
          timeWindow: number; // in minutes
        };
      };
    }
  • Tool metadata registration providing description, title, and annotations (readOnlyHint, destructiveHint, etc.) for the MCP tool 'manage_security_alert_policies'.
    manage_security_alert_policies: {
      description: "Manage security alert policies for monitoring threats, suspicious activities, and compliance violations across Microsoft 365.",
      title: "Security Alert Policy Manager",
      annotations: { title: "Security Alert Policy Manager", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }
Behavior3/5

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

Annotations indicate destructiveHint=true, readOnlyHint=false, and idempotentHint=false, which already tell the agent this is a mutating, non-idempotent, potentially destructive operation. The description adds context about what gets managed (security alert policies for monitoring threats), but doesn't provide additional behavioral details like authentication requirements, rate limits, or specific destructive consequences beyond what annotations already convey.

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 communicates the core purpose without unnecessary elaboration. It's appropriately sized for a complex tool, though it could potentially benefit from being more front-loaded with key differentiators given the many sibling tools.

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 9 parameters, nested objects, destructive operations, and no output schema, the description is minimal. While annotations cover safety aspects and the schema documents parameters thoroughly, the description doesn't help the agent understand the tool's scope, return values, or operational context beyond the basic purpose statement.

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 input schema already provides comprehensive parameter documentation including enums and nested object structures. The description mentions 'monitoring threats, suspicious activities, and compliance violations' which loosely relates to the 'category' parameter options, but adds minimal semantic value beyond what's already in the well-documented schema.

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 verb ('manage') and resource ('security alert policies') with context about monitoring threats, suspicious activities, and compliance violations across Microsoft 365. It distinguishes from some siblings like 'manage_alerts' by specifying policies rather than alerts themselves, but doesn't explicitly differentiate from all security-related tools like 'manage_defender_policies' or 'manage_compliance_monitoring'.

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. With many sibling tools for managing security, compliance, and policies, there's no indication of when this specific tool for security alert policies is appropriate versus tools like 'manage_defender_policies', 'manage_compliance_monitoring', or 'manage_alerts'.

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