Skip to main content
Glama
stefanskiasan

Azure DevOps MCP Server for Cline

get_work_item

Retrieve Azure DevOps work items by ID to access details like title, state, and fields. Specify IDs, fields to include, and expansion options for comprehensive data retrieval.

Instructions

Get work items by IDs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYesWork item IDs
fieldsNoFields to include (e.g., "System.Title", "System.State")
asOfNoAs of a specific date (ISO 8601)
$expandNoExpand options (None=0, Relations=1, Fields=2, Links=3, All=4)
errorPolicyNoError policy (Fail=1, Omit=2)

Implementation Reference

  • The main handler function that executes the tool: validates input, initializes connection, calls Azure DevOps WorkItemTrackingApi.getWorkItems, formats response as MCP content.
    export async function getWorkItem(args: WorkItemBatchGetRequest, config: AzureDevOpsConfig) {
      if (!args.ids || !args.ids.length) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid work item ID');
      }
    
      AzureDevOpsConnection.initialize(config);
      const connection = AzureDevOpsConnection.getInstance();
      const workItemTrackingApi = await connection.getWorkItemTrackingApi();
      const workItems = await workItemTrackingApi.getWorkItems(
        args.ids,
        args.fields || ['System.Id', 'System.Title', 'System.State', 'System.Description'],
        args.asOf,
        WorkItemExpand.All,
        args.errorPolicy,
        config.project
      );
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(workItems, null, 2),
          },
        ],
      };
    }
  • MCP input schema definition for the 'get_work_item' tool, specifying parameters like ids (required array of numbers), optional fields, asOf date, expand enum, errorPolicy enum.
    {
      name: 'get_work_item',
      description: 'Get work items by IDs',
      inputSchema: {
        type: 'object',
        properties: {
          ids: {
            type: 'array',
            items: {
              type: 'number'
            },
            description: 'Work item IDs',
          },
          fields: {
            type: 'array',
            items: {
              type: 'string'
            },
            description: 'Fields to include (e.g., "System.Title", "System.State")',
          },
          asOf: {
            type: 'string',
            format: 'date-time',
            description: 'As of a specific date (ISO 8601)',
          },
          $expand: {
            type: 'number',
            enum: [0, 1, 2, 3, 4],
            description: 'Expand options (None=0, Relations=1, Fields=2, Links=3, All=4)',
          },
          errorPolicy: {
            type: 'number',
            enum: [1, 2],
            description: 'Error policy (Fail=1, Omit=2)',
          }
        },
        required: ['ids'],
      },
    },
  • Registers the getWorkItem handler (along with others) in the workItemTools.initialize function, binding the config parameter and exporting tool definitions.
    export const workItemTools = {
      initialize: (config: AzureDevOpsConfig) => ({
        getWorkItem: (args: WorkItemBatchGetRequest) => getWorkItem(args, config),
        listWorkItems: (args: Wiql) => listWorkItems(args, config),
        createWorkItem: (args: { type: string; document: JsonPatchOperation[] }) => createWorkItem(args, config),
        updateWorkItem: (args: { id: number; document: JsonPatchOperation[] }) => updateWorkItem(args, config),
        definitions,
      }),
      definitions,
  • src/index.ts:126-128 (registration)
    Top-level dispatch/registration in the MCP server request handler switch statement, routing 'get_work_item' calls to tools.workItem.getWorkItem.
    case 'get_work_item':
      result = await tools.workItem.getWorkItem(request.params.arguments);
      break;
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Get work items by IDs' implies a read-only operation, but it doesn't specify authentication requirements, rate limits, pagination behavior, error responses, or what happens with invalid IDs. The description lacks details on return format, performance characteristics, or side effects, leaving significant gaps for a tool with 5 parameters.

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 phrase ('Get work items by IDs') that front-loads the core purpose without unnecessary words. Every word earns its place: 'Get' specifies the action, 'work items' the resource, and 'by IDs' the key input mechanism. There's no 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 tool's complexity (5 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain return values, error handling, or behavioral nuances like how 'errorPolicy' affects responses or what 'asOf' means in practice. For a read operation with multiple configuration options, more context is needed to guide effective use.

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 all parameters well-documented in the schema itself (e.g., 'ids' as work item IDs, 'fields' with examples, 'asOf' with format, enums for '$expand' and 'errorPolicy'). The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline of 3 where 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 'Get work items by IDs' clearly states the verb ('Get') and resource ('work items'), and specifies the primary input mechanism ('by IDs'). It distinguishes from siblings like 'list_work_items' (which presumably lists without specific IDs) and 'get_boards' (different resource). However, it doesn't explicitly differentiate from 'get_wiki_page' or 'get_wikis' in terms of resource type specificity.

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 sibling tools like 'list_work_items' (for listing without specific IDs) or 'update_work_item' (for modifications), nor does it specify prerequisites, error handling context, or typical use cases. Usage is implied only by the tool name and parameters.

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/stefanskiasan/azure-devops-mcp-server'

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