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;

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