Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

wit_get_work_items_batch_by_ids

Retrieve multiple work items in bulk by specifying their IDs and project details within Azure DevOps, with optional field customization for tailored responses.

Instructions

Retrieve list of work items by IDs in batch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoOptional list of fields to include in the response. If not provided, a hardcoded default set of fields will be used.
idsYesThe IDs of the work items to retrieve.
projectYesThe name or ID of the Azure DevOps project.

Implementation Reference

  • The handler function that executes the tool logic: connects to Azure DevOps, fetches work items by IDs in batch, processes identity fields to string format, and returns JSON stringified response.
    async ({ project, ids, fields }) => {
      const connection = await connectionProvider();
      const workItemApi = await connection.getWorkItemTrackingApi();
      const defaultFields = ["System.Id", "System.WorkItemType", "System.Title", "System.State", "System.Parent", "System.Tags", "Microsoft.VSTS.Common.StackRank", "System.AssignedTo"];
    
      // If no fields are provided, use the default set of fields
      const fieldsToUse = !fields || fields.length === 0 ? defaultFields : fields;
    
      const workitems = await workItemApi.getWorkItemsBatch({ ids, fields: fieldsToUse }, project);
    
      // List of identity fields that need to be transformed from objects to formatted strings
      const identityFields = [
        "System.AssignedTo",
        "System.CreatedBy",
        "System.ChangedBy",
        "System.AuthorizedAs",
        "Microsoft.VSTS.Common.ActivatedBy",
        "Microsoft.VSTS.Common.ResolvedBy",
        "Microsoft.VSTS.Common.ClosedBy",
      ];
    
      // Format identity fields to include displayName and uniqueName
      // Removing the identity object as the response. It's too much and not needed
      if (workitems && Array.isArray(workitems)) {
        workitems.forEach((item) => {
          if (item.fields) {
            identityFields.forEach((fieldName) => {
              if (item.fields && item.fields[fieldName] && typeof item.fields[fieldName] === "object") {
                const identityField = item.fields[fieldName];
                const name = identityField.displayName || "";
                const email = identityField.uniqueName || "";
                item.fields[fieldName] = `${name} <${email}>`.trim();
              }
            });
          }
        });
      }
    
      return {
        content: [{ type: "text", text: JSON.stringify(workitems, null, 2) }],
      };
    }
  • Zod input schema defining parameters: project (string), ids (array of numbers), optional fields (array of strings).
    {
      project: z.string().describe("The name or ID of the Azure DevOps project."),
      ids: z.array(z.number()).describe("The IDs of the work items to retrieve."),
      fields: z.array(z.string()).optional().describe("Optional list of fields to include in the response. If not provided, a hardcoded default set of fields will be used."),
    },
  • Registration of the tool using McpServer.tool() with name from WORKITEM_TOOLS.get_work_items_batch_by_ids ('wit_get_work_items_batch_by_ids'), description, schema, and handler.
    server.tool(
      WORKITEM_TOOLS.get_work_items_batch_by_ids,
      "Retrieve list of work items by IDs in batch.",
      {
        project: z.string().describe("The name or ID of the Azure DevOps project."),
        ids: z.array(z.number()).describe("The IDs of the work items to retrieve."),
        fields: z.array(z.string()).optional().describe("Optional list of fields to include in the response. If not provided, a hardcoded default set of fields will be used."),
      },
      async ({ project, ids, fields }) => {
        const connection = await connectionProvider();
        const workItemApi = await connection.getWorkItemTrackingApi();
        const defaultFields = ["System.Id", "System.WorkItemType", "System.Title", "System.State", "System.Parent", "System.Tags", "Microsoft.VSTS.Common.StackRank", "System.AssignedTo"];
    
        // If no fields are provided, use the default set of fields
        const fieldsToUse = !fields || fields.length === 0 ? defaultFields : fields;
    
        const workitems = await workItemApi.getWorkItemsBatch({ ids, fields: fieldsToUse }, project);
    
        // List of identity fields that need to be transformed from objects to formatted strings
        const identityFields = [
          "System.AssignedTo",
          "System.CreatedBy",
          "System.ChangedBy",
          "System.AuthorizedAs",
          "Microsoft.VSTS.Common.ActivatedBy",
          "Microsoft.VSTS.Common.ResolvedBy",
          "Microsoft.VSTS.Common.ClosedBy",
        ];
    
        // Format identity fields to include displayName and uniqueName
        // Removing the identity object as the response. It's too much and not needed
        if (workitems && Array.isArray(workitems)) {
          workitems.forEach((item) => {
            if (item.fields) {
              identityFields.forEach((fieldName) => {
                if (item.fields && item.fields[fieldName] && typeof item.fields[fieldName] === "object") {
                  const identityField = item.fields[fieldName];
                  const name = identityField.displayName || "";
                  const email = identityField.uniqueName || "";
                  item.fields[fieldName] = `${name} <${email}>`.trim();
                }
              });
            }
          });
        }
    
        return {
          content: [{ type: "text", text: JSON.stringify(workitems, null, 2) }],
        };
      }
  • Tool name mapping in WORKITEM_TOOLS constant used for registration.
    get_work_items_batch_by_ids: "wit_get_work_items_batch_by_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 of behavioral disclosure. It states the tool retrieves work items but doesn't describe what happens on errors (e.g., invalid IDs), whether it's read-only, rate limits, authentication needs, or the response format. For a batch retrieval tool with zero annotation coverage, this is a significant gap in behavioral context.

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 with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place without redundancy or fluff.

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

Completeness2/5

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

Given the complexity of batch operations (3 parameters, no output schema, no annotations), the description is incomplete. It doesn't explain what the tool returns (e.g., list of work item objects, error handling for partial failures), behavioral traits, or usage context. For a tool with no structured output or annotation support, this leaves the agent under-informed.

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 three parameters (ids, project, fields) with clear descriptions. The description adds no additional parameter semantics beyond what's in the schema, such as ID format examples or field selection implications. Baseline 3 is appropriate when the 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 verb ('Retrieve') and resource ('list of work items by IDs in batch'), making the purpose understandable. It doesn't explicitly differentiate from sibling tools like 'wit_get_work_item' (singular) or 'wit_get_query_results_by_id', but the batch aspect is implied. This is clear but lacks explicit sibling differentiation.

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 when batch retrieval is preferred over single-item retrieval (e.g., 'wit_get_work_item'), when to use queries instead, or any prerequisites. This leaves the agent without contextual usage instructions.

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