get_work_item
Retrieve Azure DevOps work items by ID to access project details, with optional field expansion for comprehensive information retrieval.
Instructions
Gets a work item by its ID with optional field expansion.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expand | No | The expand option for the work item. Use 'All' to get all fields. | |
| work_item_id | Yes | The ID of the work item. |
Implementation Reference
- Core handler implementation: fetches the work item using the Azure DevOps Work Item Tracking client and formats the response including ID, URL, fields, and relations.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:910-911 (handler)Tool dispatch handler in _execute_tool method that invokes the client.get_work_item with parsed arguments.elif name == "get_work_item": return self.client.get_work_item(**arguments)
- mcp_azure_devops/server.py:108-122 (schema)Input schema validation for the tool parameters: work_item_id (integer, required), expand (string, optional).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:105-123 (registration)Tool registration in the self.tools list, which is returned by the list_tools handler for MCP protocol.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 } ),