Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

core_get_identity_ids

Retrieve Azure DevOps identity IDs by providing a search filter such as unique name, display name, or email, using PAT authentication.

Instructions

Retrieve Azure DevOps identity IDs for a provided search filter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchFilterYesSearch filter (unique namme, display name, email) to retrieve identity IDs for.

Implementation Reference

  • Handler function that retrieves Azure DevOps identity IDs based on a search filter using direct API call to identities endpoint.
    async ({ searchFilter }) => {
      try {
        const token = await tokenProvider();
        const connection = await connectionProvider();
        const orgName = connection.serverUrl.split("/")[3];
        const baseUrl = `https://vssps.dev.azure.com/${orgName}/_apis/identities`;
    
        const params = new URLSearchParams({
          "api-version": apiVersion,
          "searchFilter": "General",
          "filterValue": searchFilter,
        });
    
        const response = await fetch(`${baseUrl}?${params}`, {
          headers: {
            "Authorization": `Bearer ${token.token}`,
            "Content-Type": "application/json",
            "User-Agent": userAgentProvider(),
          },
        });
    
        if (!response.ok) {
          const errorText = await response.text();
          throw new Error(`HTTP ${response.status}: ${errorText}`);
        }
    
        const identities = await response.json();
    
        if (!identities || identities.value?.length === 0) {
          return { content: [{ type: "text", text: "No identities found" }], isError: true };
        }
    
        const identitiesTrimmed = identities.value?.map((identity: IdentityBase) => {
          return {
            id: identity.id,
            displayName: identity.providerDisplayName,
            descriptor: identity.descriptor,
          };
        });
    
        return {
          content: [{ type: "text", text: JSON.stringify(identitiesTrimmed, null, 2) }],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
    
        return {
          content: [{ type: "text", text: `Error fetching identities: ${errorMessage}` }],
          isError: true,
        };
      }
    }
  • Input schema using Zod for the searchFilter parameter.
    {
      searchFilter: z.string().describe("Search filter (unique namme, display name, email) to retrieve identity IDs for."),
    },
  • Tool registration using McpServer.tool() with name from CORE_TOOLS, description, schema, and handler.
    server.tool(
      CORE_TOOLS.get_identity_ids,
      "Retrieve Azure DevOps identity IDs for a provided search filter.",
      {
        searchFilter: z.string().describe("Search filter (unique namme, display name, email) to retrieve identity IDs for."),
      },
      async ({ searchFilter }) => {
        try {
          const token = await tokenProvider();
          const connection = await connectionProvider();
          const orgName = connection.serverUrl.split("/")[3];
          const baseUrl = `https://vssps.dev.azure.com/${orgName}/_apis/identities`;
    
          const params = new URLSearchParams({
            "api-version": apiVersion,
            "searchFilter": "General",
            "filterValue": searchFilter,
          });
    
          const response = await fetch(`${baseUrl}?${params}`, {
            headers: {
              "Authorization": `Bearer ${token.token}`,
              "Content-Type": "application/json",
              "User-Agent": userAgentProvider(),
            },
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            throw new Error(`HTTP ${response.status}: ${errorText}`);
          }
    
          const identities = await response.json();
    
          if (!identities || identities.value?.length === 0) {
            return { content: [{ type: "text", text: "No identities found" }], isError: true };
          }
    
          const identitiesTrimmed = identities.value?.map((identity: IdentityBase) => {
            return {
              id: identity.id,
              displayName: identity.providerDisplayName,
              descriptor: identity.descriptor,
            };
          });
    
          return {
            content: [{ type: "text", text: JSON.stringify(identitiesTrimmed, null, 2) }],
          };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
    
          return {
            content: [{ type: "text", text: `Error fetching identities: ${errorMessage}` }],
            isError: true,
          };
        }
      }
    );
  • Constant mapping internal tool names to MCP tool names, used in registration.
    const CORE_TOOLS = {
      list_project_teams: "core_list_project_teams",
      list_projects: "core_list_projects",
      get_identity_ids: "core_get_identity_ids",
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool retrieves IDs but doesn't disclose behavioral traits like authentication requirements, rate limits, pagination, error handling, or what happens if no matches are found. This leaves significant gaps for a retrieval operation.

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 appropriately sized and front-loaded, making it easy to 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 moderate complexity (retrieval with a filter), no annotations, and no output schema, the description is minimally adequate but incomplete. It covers the basic purpose but lacks details on behavior, usage context, and output format, which are important for effective tool invocation.

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 the single parameter 'searchFilter' with its description. The description adds no additional meaning beyond what the schema provides, such as examples of valid filters or search syntax. 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.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Retrieve') and resource ('Azure DevOps identity IDs') with a specific scope ('for a provided search filter'). It distinguishes itself from sibling tools that handle builds, releases, repositories, etc., but doesn't explicitly differentiate from potential identity-related siblings (none are listed).

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?

No guidance is provided on when to use this tool versus alternatives. The description mentions a search filter but doesn't specify scenarios, prerequisites, or exclusions. Sibling tools include various retrieval functions, but no explicit comparison is made.

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

Related 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/ennuiii/DevOpsMcpPAT'

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