get_work_item
Retrieve a specific work item by ID from Azure DevOps, with options to expand field details for comprehensive project tracking.
Instructions
Gets a work item by its ID with optional field expansion.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| work_item_id | Yes | The ID of the work item. | |
| expand | No | The expand option for the work item. Use 'All' to get all fields. |
Implementation Reference
- The core handler function that fetches the work item from Azure DevOps API using the Work Item Tracking client, formats the fields and relations into a structured dictionary, and returns it.def get_work_item(self, work_item_id, expand=None): work_item = self.work_item_tracking_client.get_work_item(id=work_item_id, expand=expand) result = { "id": work_item.id, "url": work_item.url, "fields": work_item.fields } if work_item.relations: result["relations"] = [ { "rel": r.rel, "url": r.url, "attributes": r.attributes } for r in work_item.relations ] return result
- mcp_azure_devops/server.py:105-123 (schema)The input schema definition for the 'get_work_item' tool, specifying work_item_id as required integer and optional expand string parameter.types.Tool( name="get_work_item", description="Gets a work item by its ID with optional field expansion.", inputSchema={ "type": "object", "properties": { "work_item_id": { "type": "integer", "description": "The ID of the work item." }, "expand": { "type": "string", "description": "The expand option for the work item. Use 'All' to get all fields." }, }, "required": ["work_item_id"], "additionalProperties": False } ),
- mcp_azure_devops/server.py:910-911 (registration)The dispatch logic in the _execute_tool method that registers and routes the 'get_work_item' tool call to the AzureDevOpsClient instance method.elif name == "get_work_item": return self.client.get_work_item(**arguments)