Skip to main content
Glama
DynamicEndpoints

Microsoft 365 Core MCP Server

manage_gap_analysis

Read-onlyIdempotent

Identify compliance gaps in Microsoft 365 against frameworks like HITRUST, ISO 27001, or SOC 2 and generate remediation recommendations with risk prioritization.

Instructions

Perform gap analysis to identify compliance deficiencies and generate remediation recommendations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesGap analysis action
analysisIdNoAnalysis ID
frameworkYesFramework for gap analysis
targetFrameworkNoTarget framework for cross-framework mapping
scopeNoAnalysis scope
settingsNoAnalysis settings

Implementation Reference

  • Main handler function for manage_gap_analysis tool. Dispatches to generate, get_results, or export actions, calling helper functions for gap analysis logic.
    export async function handleGapAnalysis(
      graphClient: Client,
      args: GapAnalysisArgs
    ): Promise<{ content: { type: string; text: string }[] }> {
      let result: any;
    
      switch (args.action) {
        case 'generate':
          // Generate gap analysis
          const analysisId = `gap-analysis-${Date.now()}`;
          result = await generateGapAnalysis(graphClient, analysisId, args);
          break;
    
        case 'get_results':
          if (!args.analysisId) {
            throw new McpError(ErrorCode.InvalidParams, 'analysisId is required for get_results action');
          }
          
          result = await getGapAnalysisResults(args.analysisId);
          break;
    
        case 'export':
          if (!args.analysisId) {
            throw new McpError(ErrorCode.InvalidParams, 'analysisId is required for export action');
          }
          
          result = await exportGapAnalysis(args.analysisId);
          break;
    
        default:
          throw new McpError(ErrorCode.InvalidParams, `Invalid action: ${args.action}`);
      }
    
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • src/server.ts:985-1005 (registration)
    MCP server tool registration for 'manage_gap_analysis'. Links the schema, metadata annotations, and handler function.
    // Gap Analysis - Lazy loading enabled for tool discovery
    this.server.tool(
      "manage_gap_analysis",
      "Perform gap analysis to identify compliance deficiencies and generate remediation recommendations.",
      gapAnalysisSchema.shape,
      {"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true},
      wrapToolHandler(async (args: GapAnalysisArgs) => {
        this.validateCredentials();
        try {
          return await handleGapAnalysis(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'}`
          );
        }
      })
    );
  • Zod input schema definition for the manage_gap_analysis tool, defining parameters like action, framework, scope, and settings.
    export const gapAnalysisSchema = z.object({
      action: z.enum(['generate', 'get_results', 'export']).describe('Gap analysis action'),
      analysisId: z.string().optional().describe('Analysis ID'),
      framework: z.enum(['hitrust', 'iso27001', 'soc2']).describe('Framework for gap analysis'),
      targetFramework: z.enum(['hitrust', 'iso27001', 'soc2']).optional().describe('Target framework for cross-framework mapping'),
      scope: z.object({
        controlIds: z.array(z.string()).optional().describe('Control IDs'),
        categories: z.array(z.string()).optional().describe('Categories'),
      }).optional().describe('Analysis scope'),
      settings: z.object({
        includeRecommendations: z.boolean().describe('Include recommendations'),
        prioritizeByRisk: z.boolean().describe('Prioritize by risk'),
        includeTimeline: z.boolean().describe('Include timeline'),
        includeCostEstimate: z.boolean().describe('Include cost estimate'),
      }).optional().describe('Analysis settings'),
    });
  • TypeScript interface defining the input arguments structure (GapAnalysisArgs) used by the handler and schema.
    export interface GapAnalysisArgs {
      action: 'generate' | 'get_results' | 'export';
      analysisId?: string;
      framework: 'hitrust' | 'iso27001' | 'soc2';
      targetFramework?: 'hitrust' | 'iso27001' | 'soc2'; // For cross-framework mapping
      scope?: {
        controlIds?: string[];
        categories?: string[];
      };
      settings?: {
        includeRecommendations: boolean;
        prioritizeByRisk: boolean;
        includeTimeline: boolean;
        includeCostEstimate: boolean;
      };
    }
  • src/handlers.ts:47-60 (registration)
    Import statement bringing the handleGapAnalysis handler into the main handlers file, making it available for server registration.
    import {
      handleComplianceFrameworks,
      handleComplianceAssessments,
      handleComplianceMonitoring,
      handleEvidenceCollection,
      handleGapAnalysis
    } from './handlers/compliance-handler.js';
    import {
      ComplianceFrameworkArgs,
      ComplianceAssessmentArgs,
      ComplianceMonitoringArgs,
      EvidenceCollectionArgs,
      GapAnalysisArgs
    } from './types/compliance-types.js';
  • Tool metadata including description, title, and annotations (readOnlyHint, destructiveHint, etc.) used in registration.
    manage_gap_analysis: {
      description: "Perform gap analysis to identify compliance deficiencies and generate remediation recommendations.",
      title: "Compliance Gap Analyzer",
      annotations: { title: "Compliance Gap Analyzer", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the agent knows this is a safe, repeatable read operation. The description adds context about what the tool does (identify deficiencies, generate recommendations) but doesn't provide additional behavioral details like whether it's computationally intensive, has rate limits, requires specific permissions, or how results are returned. With annotations covering the safety profile, this meets baseline expectations.

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 clearly states the tool's purpose. There's no wasted language or unnecessary elaboration. It's appropriately sized and front-loaded with the essential information.

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 (6 parameters with nested objects, no output schema), the description is adequate but minimal. Annotations provide safety information, and the schema documents parameters well, but the description doesn't address output format, result interpretation, or error conditions. For a tool that performs analysis and generates recommendations, more context about what to expect would be helpful.

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%, so the schema already documents all 6 parameters thoroughly with descriptions and enums. The description doesn't add any parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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: 'Perform gap analysis to identify compliance deficiencies and generate remediation recommendations.' It specifies the verb 'perform' and resource 'gap analysis' with outcomes. However, it doesn't distinguish this from sibling tools like 'manage_compliance_assessments' or 'manage_cis_compliance', which appear related to compliance management.

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. There are multiple compliance-related sibling tools (e.g., manage_compliance_assessments, manage_cis_compliance, manage_compliance_frameworks), but the description doesn't explain how this gap analysis tool differs from them or when it's the appropriate choice.

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