Skip to main content
Glama
DynamicEndpoints

Microsoft 365 Core MCP Server

manage_alerts

Idempotent

Manage security alerts from Microsoft Defender and other products to investigate and remediate threats in Microsoft 365 environments.

Instructions

Manage security alerts from Microsoft Defender and other security products including investigation and remediation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAlert management action
alertIdNoID of the alert (required for get_alert)
filterNoOData filter string (e.g., 'status eq \'new\'')
topNoMaximum number of alerts to return

Implementation Reference

  • The core handler function that implements the manage_alerts tool logic. It uses Microsoft Graph API's /security/alerts_v2 endpoint to list or get security alerts based on the action parameter.
    export async function handleManageAlerts(
      graphClient: Client,
      args: AlertArgs
    ): Promise<{ content: { type: string; text: string }[] }> {
      // Uses the newer alerts_v2 endpoint
      // Requires SecurityAlert.Read.All permission
      let apiPath = '/security/alerts_v2';
      let result: any;
    
      switch (args.action) {
        case 'list_alerts': {
          const queryOptions: string[] = [];
          if (args.filter) {
            queryOptions.push(`$filter=${encodeURIComponent(args.filter)}`);
          }
          if (args.top) {
            queryOptions.push(`$top=${args.top}`);
          }
          if (queryOptions.length > 0) {
            apiPath += `?${queryOptions.join('&')}`;
          }
          result = await graphClient.api(apiPath).get();
          break;
        }
        case 'get_alert': {
          if (!args.alertId) {
            throw new McpError(ErrorCode.InvalidParams, 'alertId is required for get_alert');
          }
          apiPath += `/${args.alertId}`;
          result = await graphClient.api(apiPath).get();
          break;
        }
        default:
          throw new McpError(ErrorCode.InvalidParams, `Invalid action: ${args.action}`);
      }
    
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • TypeScript interface defining the input parameters for the manage_alerts tool handler.
    export interface AlertArgs {
      action: 'list_alerts' | 'get_alert';
      alertId?: string;
      filter?: string;
      top?: number;
    }
  • src/server.ts:656-675 (registration)
    MCP server tool registration for 'manage_alerts', linking the handler function, input schema, and metadata annotations.
    this.server.tool(
      "manage_alerts",
      "Manage security alerts from Microsoft Defender and other security products including investigation and remediation.",
      alertSchema.shape,
      {"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true},
      wrapToolHandler(async (args: AlertArgs) => {
        // Validate credentials only when tool is executed (lazy loading)
        this.validateCredentials();
        try {
          return await handleManageAlerts(this.getGraphClient(), args);
        } catch (error) {
          if (error instanceof McpError) {
            throw error;
          }
          throw new McpError(
            ErrorCode.InternalError,
            `Error executing tool: ${error instanceof Error ? error.message : 'Unknown error'}`
          );        }
      })
    );
  • Tool metadata providing description, title, and annotations used during MCP tool registration.
    manage_alerts: {
      description: "Manage security alerts from Microsoft Defender and other security products including investigation and remediation.",
      title: "Security Alert Manager",
      annotations: { title: "Security Alert Manager", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }
  • src/index.ts:341-341 (registration)
    Tool listed in HTTP capabilities endpoint response for client discovery.
    'manage_alerts'
Behavior3/5

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

Annotations indicate readOnlyHint=false, idempotentHint=true, and destructiveHint=false, covering basic safety and idempotency. The description adds context by mentioning 'investigation and remediation', which implies both read and write operations, aligning with annotations. However, it doesn't disclose additional behavioral traits like rate limits, authentication needs, or specific remediation actions, leaving gaps in understanding the tool's full behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded with the core function and includes key details (scope and activities) concisely. Every part of the sentence earns its place, making it easy to parse and understand quickly.

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?

Given the tool's complexity (managing alerts with potential write operations) and the absence of an output schema, the description is moderately complete. It covers the tool's scope and activities but lacks details on return values, error handling, or specific remediation steps. Annotations provide some safety context, but more behavioral information would enhance completeness for effective agent 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?

Schema description coverage is 100%, with clear descriptions for all parameters (action, alertId, filter, top). The description doesn't add any parameter-specific semantics beyond what the schema provides, such as examples of remediation actions or filter usage details. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, but no extra value is added.

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 security alerts from Microsoft Defender and other security products including investigation and remediation.' It specifies the verb ('manage') and resource ('security alerts'), and mentions the scope (Microsoft Defender and other security products) and activities (investigation and remediation). However, it doesn't explicitly differentiate from sibling tools like 'manage_security_alert_policies' or 'manage_dlp_incidents', which reduces clarity about its unique role.

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 any prerequisites, constraints, or comparison to sibling tools such as 'manage_security_alert_policies' or 'manage_dlp_incidents'. The agent must infer usage from the tool name and schema alone, which is insufficient for informed decision-making.

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