This document describes the tools available for working with Azure DevOps work items.
get_work_item
- Retrieve a specific work item by IDcreate_work_item
- Create a new work itemlist_work_items
- List work items in a project
Retrieves a work item by its ID.
Parameter | Type | Required | Description |
---|---|---|---|
workItemId |
number | Yes | The ID of the work item to retrieve |
expand |
string | No | Controls the level of detail in the response. Defaults to "All" if not specified. Other values: "Relations", "Fields", "None" |
Returns a work item object with the following structure:
{
"id": 123,
"fields": {
"System.Title": "Sample Work Item",
"System.State": "Active",
"System.AssignedTo": "[email protected]",
"System.Description": "Description of the work item"
},
"url": "https://dev.azure.com/organization/project/_apis/wit/workItems/123"
}
- Returns
AzureDevOpsResourceNotFoundError
if the work item does not exist - Returns
AzureDevOpsAuthenticationError
if authentication fails - Returns generic error messages for other failures
// Using default expand="All"
const result = await callTool('get_work_item', {
workItemId: 123,
});
// Explicitly specifying expand
const minimalResult = await callTool('get_work_item', {
workItemId: 123,
expand: 'None'
});
Creates a new work item in a specified project.
Parameter | Type | Required | Description |
---|---|---|---|
projectId |
string | Yes | The ID or name of the project where the work item will be created |
workItemType |
string | Yes | The type of work item to create (e.g., "Task", "Bug", "User Story") |
title |
string | Yes | The title of the work item |
description |
string | No | The description of the work item |
assignedTo |
string | No | The email or name of the user to assign the work item to |
areaPath |
string | No | The area path for the work item |
iterationPath |
string | No | The iteration path for the work item |
priority |
number | No | The priority of the work item |
additionalFields |
object | No | Additional fields to set on the work item (key-value pairs) |
Returns the newly created work item object:
{
"id": 124,
"fields": {
"System.Title": "New Work Item",
"System.State": "New",
"System.Description": "Description of the new work item",
"System.AssignedTo": "[email protected]",
"System.AreaPath": "Project\\Team",
"System.IterationPath": "Project\\Sprint 1",
"Microsoft.VSTS.Common.Priority": 2
},
"url": "https://dev.azure.com/organization/project/_apis/wit/workItems/124"
}
- Returns validation error if required fields are missing
- Returns
AzureDevOpsAuthenticationError
if authentication fails - Returns
AzureDevOpsResourceNotFoundError
if the project does not exist - Returns generic error messages for other failures
const result = await callTool('create_work_item', {
projectId: 'my-project',
workItemType: 'User Story',
title: 'Implement login functionality',
description:
'Create a secure login system with email and password authentication',
assignedTo: '[email protected]',
priority: 1,
additionalFields: {
'Custom.Field': 'Custom Value',
},
});
The tool creates a JSON patch document to define the fields of the work item, then calls the Azure DevOps API to create the work item. Each field is added to the document with an 'add' operation, and the document is submitted to the API.
Lists work items in a specified project.
Parameter | Type | Required | Description |
---|---|---|---|
projectId |
string | Yes | The ID or name of the project to list work items from |
teamId |
string | No | The ID of the team to list work items for |
queryId |
string | No | ID of a saved work item query |
wiql |
string | No | Work Item Query Language (WIQL) query |
top |
number | No | Maximum number of work items to return |
skip |
number | No | Number of work items to skip |
Returns an array of work item objects:
[
{
"id": 123,
"fields": {
"System.Title": "Sample Work Item",
"System.State": "Active",
"System.AssignedTo": "[email protected]"
},
"url": "https://dev.azure.com/organization/project/_apis/wit/workItems/123"
},
{
"id": 124,
"fields": {
"System.Title": "Another Work Item",
"System.State": "New",
"System.AssignedTo": "[email protected]"
},
"url": "https://dev.azure.com/organization/project/_apis/wit/workItems/124"
}
]
- Returns
AzureDevOpsResourceNotFoundError
if the project does not exist - Returns
AzureDevOpsAuthenticationError
if authentication fails - Returns generic error messages for other failures
const result = await callTool('list_work_items', {
projectId: 'my-project',
wiql: "SELECT [System.Id] FROM WorkItems WHERE [System.WorkItemType] = 'Task' ORDER BY [System.CreatedDate] DESC",
top: 10,
});