Skip to main content
Glama
DynamicEndpoints

Microsoft 365 Core MCP Server

manage_offboarding

Destructive

Automate user offboarding processes including account disablement, license removal, data backup, and access revocation in Microsoft 365 environments.

Instructions

Automate user offboarding processes including account disablement, license removal, data backup, and access revocation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesOffboarding process action
userIdYesUser ID or UPN to offboard
optionsNoOffboarding options

Implementation Reference

  • The core handler function that implements the 'manage_offboarding' tool logic. It handles three actions: 'start' (disables account, revokes sessions, optional backup), 'check' (retrieves user status), and 'complete' (converts to shared mailbox or deletes user). Uses Microsoft Graph API calls.
    // Offboarding Handler
    export async function handleOffboarding(
      graphClient: Client,
      args: OffboardingArgs
    ): Promise<{ content: { type: string; text: string }[] }> {
      switch (args.action) {
        case 'start': {
          // Block sign-ins
          await graphClient
            .api(`/users/${args.userId}`)
            .patch({ accountEnabled: false });
    
          if (args.options?.revokeAccess) {
            // Revoke all refresh tokens
            await graphClient
              .api(`/users/${args.userId}/revokeSignInSessions`)
              .post({});
          }
    
          if (args.options?.backupData) {
            // Trigger backup
            await graphClient
              .api(`/users/${args.userId}/drive/content`)
              .get();
          }
    
          return { content: [{ type: 'text', text: 'Offboarding process started successfully' }] };
        }
        case 'check': {
          const status = await graphClient
            .api(`/users/${args.userId}`)
            .get();
          return { content: [{ type: 'text', text: JSON.stringify(status, null, 2) }] };
        }
        case 'complete': {
          if (args.options?.convertToShared) {
            // Convert to shared mailbox
            await graphClient
              .api(`/users/${args.userId}/mailbox/convert`)
              .post({});
          } else if (!args.options?.retainMailbox) {
            // Delete user if not retaining mailbox
            await graphClient
              .api(`/users/${args.userId}`)
              .delete();
          }
          return { content: [{ type: 'text', text: 'Offboarding process completed successfully' }] };
        }
        default:
          throw new McpError(ErrorCode.InvalidParams, `Invalid action: ${args.action}`);
      }
    }
  • src/server.ts:457-477 (registration)
    Registers the 'manage_offboarding' tool with the MCP server, linking to the handleOffboarding handler, offboardingSchema for input validation, and metadata annotations.
    this.server.tool(
      "manage_offboarding",
      "Automate user offboarding processes including account disablement, license removal, data backup, and access revocation.",
      offboardingSchema.shape,
      {"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false},
      wrapToolHandler(async (args: OffboardingArgs) => {
        // Validate credentials only when tool is executed (lazy loading)
        this.validateCredentials();
        try {
          return await handleOffboarding(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'}`
          );
        }
      })
    );    // SharePoint Sites - Lazy loading enabled for tool discovery
  • Zod schema defining the input parameters for the 'manage_offboarding' tool, including required action and userId, and optional offboarding options.
    export const offboardingSchema = z.object({
      action: z.enum(['start', 'check', 'complete']).describe('Offboarding process action'),
      userId: z.string().describe('User ID or UPN to offboard'),
      options: z.object({
        revokeAccess: z.boolean().optional().describe('Revoke all access immediately'),
        retainMailbox: z.boolean().optional().describe('Retain user mailbox'),
        convertToShared: z.boolean().optional().describe('Convert mailbox to shared'),
        backupData: z.boolean().optional().describe('Backup user data'),
      }).optional().describe('Offboarding options'),
    });
  • Tool metadata providing description, title, and annotations (readOnlyHint, destructiveHint, etc.) for the 'manage_offboarding' tool used in MCP server capabilities and discovery.
    manage_offboarding: {
      description: "Automate user offboarding processes including account disablement, license removal, data backup, and access revocation.",
      title: "User Offboarding Manager",
      annotations: { title: "User Offboarding Manager", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }
  • TypeScript interface defining the OffboardingArgs type used by the handler and schema for type safety.
    export interface OffboardingArgs {
      action: 'start' | 'check' | 'complete';
      userId: string;
      options?: {
        revokeAccess?: boolean;
        retainMailbox?: boolean;
        convertToShared?: boolean;
        backupData?: boolean;
      };
    }
Behavior4/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, and idempotentHint=false. The description adds valuable context by specifying the scope of destructive actions ('account disablement', 'license removal', 'access revocation') and the inclusion of data backup. It doesn't mention rate limits, authentication requirements, or error handling, but provides meaningful behavioral details beyond annotations.

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 front-loads the core purpose ('Automate user offboarding processes') followed by specific components. Every phrase adds value with zero wasted words or redundancy.

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 destructive tool with no output schema, the description adequately covers the high-level process but lacks details on return values, error conditions, or system state changes. The annotations provide safety context, but more behavioral transparency would help given the tool's complexity and potential impact.

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 fully documents all parameters. The description implies the 'action' parameter controls process stages and 'options' customize offboarding steps, but adds no syntax, format, or constraint details beyond what the schema provides. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose5/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 with specific verbs ('automate', 'disablement', 'removal', 'backup', 'revocation') and resources ('user offboarding processes', 'account', 'license', 'data', 'access'). It distinguishes from sibling tools by focusing on user lifecycle management rather than compliance, reporting, or infrastructure 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. It doesn't mention prerequisites, timing considerations, or which sibling tools might be complementary or overlapping. The agent must infer usage from the purpose alone.

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