Skip to main content
Glama
DynamicEndpoints

Microsoft 365 Core MCP Server

manage_azure_ad_apps

Destructive

Manage Azure AD application registrations to configure permissions, credentials, and OAuth settings for secure access control.

Instructions

Manage Azure AD application registrations including app permissions, credentials, and OAuth configurations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAzure AD application management action
appIdNoObject ID of the application
ownerIdNoObject ID of the user to add/remove as owner
appDetailsNoApplication details for updates
filterNoOData filter string

Implementation Reference

  • Handler function that implements the core logic for managing Azure AD applications. Handles actions like list_apps, get_app, update_app, add_owner, and remove_owner using Microsoft Graph API.
    export async function handleAzureAdApps(
      graphClient: Client,
      args: AzureAdAppArgs
    ): Promise<{ content: { type: string; text: string }[] }> {
      let apiPath = '';
      let result: any;
    
      switch (args.action) {
        case 'list_apps':
          apiPath = '/applications';
          if (args.filter) {
            apiPath += `?$filter=${encodeURIComponent(args.filter)}`;
          }
          result = await graphClient.api(apiPath).get();
          break;
    
        case 'get_app':
          if (!args.appId) {
            throw new McpError(ErrorCode.InvalidParams, 'appId is required for get_app');
          }
          apiPath = `/applications/${args.appId}`;
          result = await graphClient.api(apiPath).get();
          break;
    
        case 'update_app':
          if (!args.appId || !args.appDetails) {
            throw new McpError(ErrorCode.InvalidParams, 'appId and appDetails are required for update_app');
          }
          apiPath = `/applications/${args.appId}`;
          await graphClient.api(apiPath).patch(args.appDetails);
          result = { message: 'Application updated successfully' };
          break;
    
        case 'add_owner':
          if (!args.appId || !args.ownerId) {
            throw new McpError(ErrorCode.InvalidParams, 'appId and ownerId are required for add_owner');
          }
          apiPath = `/applications/${args.appId}/owners/$ref`;
          const ownerPayload = {
            '@odata.id': `https://graph.microsoft.com/v1.0/users/${args.ownerId}`
          };
          await graphClient.api(apiPath).post(ownerPayload);
          result = { message: 'Owner added successfully' };
          break;
    
        case 'remove_owner':
          if (!args.appId || !args.ownerId) {
            throw new McpError(ErrorCode.InvalidParams, 'appId and ownerId are required for remove_owner');
          }
          // Need to get the specific owner reference ID first, as Graph requires the owner's directoryObject ID from the owners collection
          // This is a simplification; a real implementation might need to list owners first to find the correct reference ID.
          // For now, we'll assume ownerId is the directoryObject ID of the owner within the app's owners collection.
          apiPath = `/applications/${args.appId}/owners/${args.ownerId}/$ref`;
          await graphClient.api(apiPath).delete();
          result = { message: 'Owner removed successfully' };
          break;
    
        default:
          throw new McpError(ErrorCode.InvalidParams, `Invalid action: ${args.action}`);
      }
    
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • src/server.ts:541-561 (registration)
    MCP server tool registration for manage_azure_ad_apps, linking to the handler function and schema.
    this.server.tool(
      "manage_azure_ad_apps",
      "Manage Azure AD application registrations including app permissions, credentials, and OAuth configurations.",
      azureAdAppSchema.shape,
      {"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false},
      wrapToolHandler(async (args: AzureAdAppArgs) => {
        // Validate credentials only when tool is executed (lazy loading)
        this.validateCredentials();
        try {
          return await handleAzureAdApps(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 schema defining input parameters for the manage_azure_ad_apps tool.
    export const azureAdAppSchema = z.object({
      action: z.enum(['list_apps', 'get_app', 'update_app', 'add_owner', 'remove_owner']).describe('Azure AD application management action'),
      appId: z.string().optional().describe('Object ID of the application'),
      ownerId: z.string().optional().describe('Object ID of the user to add/remove as owner'),
      appDetails: z.object({
        displayName: z.string().optional().describe('Application display name'),
        signInAudience: z.string().optional().describe('Sign-in audience setting'),
      }).optional().describe('Application details for updates'),
      filter: z.string().optional().describe('OData filter string'),
    });
  • Tool metadata providing description, title, and annotations (hints) for the manage_azure_ad_apps tool.
    manage_azure_ad_apps: {
      description: "Manage Azure AD application registrations including app permissions, credentials, and OAuth configurations.",
      title: "Azure AD App Manager",
      annotations: { title: "Azure AD App 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, covering key behavioral traits. The description adds value by specifying the scope ('app permissions, credentials, and OAuth configurations'), which hints at sensitive operations, but does not elaborate on risks, permissions needed, or rate limits. It does not contradict annotations, so a baseline score is appropriate given the annotation coverage.

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 without unnecessary words. It directly states what the tool does and includes key components, 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 (5 parameters, destructive operations, no output schema) and rich annotations, the description is adequate but minimal. It covers the high-level scope but lacks details on output format, error handling, or specific use cases, which could help the agent navigate the multiple actions and parameters more effectively.

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, including an enum for 'action' and nested object details. The description mentions general aspects like 'app permissions' and 'OAuth configurations', which loosely relate to parameters but do not add significant semantic detail beyond the schema. This meets the baseline for high schema coverage.

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 ('Azure AD application registrations') with specific aspects ('app permissions, credentials, and OAuth configurations'), making the purpose unambiguous. However, it does not explicitly differentiate from sibling tools like 'manage_service_principals' or 'manage_azure_ad_roles', which might handle related Azure AD entities, so it falls short of a perfect score.

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, such as sibling tools for managing other Azure AD components (e.g., 'manage_azure_ad_devices' or 'manage_service_principals'). It lacks explicit context, prerequisites, or exclusions, leaving the agent to infer usage based on the tool name and description 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