Skip to main content
Glama
badchars

osint-mcp-server

by badchars

m365_userrealm

Detect the authentication type for a domain's Microsoft 365 tenant, returning namespace type, federation brand, and authentication endpoints.

Instructions

Detect authentication type for a domain's Microsoft 365 tenant. Returns namespace type (Managed/Federated), federation brand name, and auth endpoints.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to check user realm for

Implementation Reference

  • The core execution function for m365_userrealm. Calls Microsoft's getuserrealm.srf API to detect authentication type (Managed/Federated) for a domain. Returns namespace type, federation brand name, auth URLs, and cloud instance name.
    export async function m365UserRealm(domain: string): Promise<M365UserRealmResult> {
      try {
        const res = await fetch(
          `https://login.microsoftonline.com/getuserrealm.srf?login=test@${encodeURIComponent(domain)}&json=1`,
        );
        if (!res.ok) return { domain, found: false };
    
        const data = await res.json();
    
        // NameSpaceType 0 = Unknown, 1 = Managed, 2 = Federated
        let namespaceType: string | undefined;
        if (data.NameSpaceType === "Managed" || data.NameSpaceType === 1) namespaceType = "Managed";
        else if (data.NameSpaceType === "Federated" || data.NameSpaceType === 2) namespaceType = "Federated";
        else if (data.NameSpaceType !== undefined) namespaceType = String(data.NameSpaceType);
    
        return {
          domain,
          found: namespaceType !== undefined,
          namespaceType,
          federationBrandName: data.FederationBrandName,
          federationActiveAuthUrl: data.AuthURL ?? data.STSAuthUrl,
          cloudInstanceName: data.CloudInstanceName ?? data.CloudInstanceIssuerUri,
        };
      } catch {
        return { domain, found: false };
      }
    }
  • Interface M365UserRealmResult defining the return type: domain, found, namespaceType, federationBrandName, federationActiveAuthUrl, cloudInstanceName.
    interface M365UserRealmResult {
      domain: string;
      found: boolean;
      namespaceType?: string; // "Managed" or "Federated"
      federationBrandName?: string;
      federationActiveAuthUrl?: string;
      cloudInstanceName?: string;
    }
  • ToolDef registration for m365_userrealm. Defines name ('m365_userrealm'), description, schema (zod: domain string), and execute handler that calls m365UserRealm().
    const m365UserRealmTool: ToolDef = {
      name: "m365_userrealm",
      description: "Detect authentication type for a domain's Microsoft 365 tenant. Returns namespace type (Managed/Federated), federation brand name, and auth endpoints.",
      schema: {
        domain: z.string().describe("Domain to check user realm for"),
      },
      execute: async (args) => json(await m365UserRealm(args.domain as string)),
    };
  • Tool registered in the allTools array export (line 528: m365UserRealmTool) that makes it available to the MCP server.
    m365UserRealmTool,
  • src/index.ts:34-34 (registration)
    Tool listed under 'Microsoft 365' category for CLI help/--list display (no API key required).
    { label: "Microsoft 365", env: null, tools: ["m365_tenant", "m365_userrealm"] },
Behavior4/5

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

No annotations are present, so the description must stand alone. It accurately describes the read-only detection operation and the return values, but does not disclose authentication requirements or potential rate limits. However, the info provided is sufficient for a simple lookup tool.

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?

A single, front-loaded sentence of 15 words conveys all essential information without redundancy. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool, the description covers purpose, inputs, and outputs. It lacks error handling details (e.g., non-existent domains), but this is a minor omission given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with a clear parameter description. The tool description adds context about the Microsoft 365 scope and specific output fields, enhancing the schema's meaning. This goes beyond the baseline 3.

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 action (detect authentication type), the resource (domain's Microsoft 365 tenant), and the expected outputs (namespace type, federation brand name, auth endpoints), distinguishing it from siblings like m365_tenant.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when or when-not to use is provided, though the single parameter implies straightforward usage. No alternatives or exclusions are mentioned, leaving the agent to infer based on the tool's name and description.

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/badchars/osint-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server