Skip to main content
Glama

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
NameRequiredDescriptionDefault
work_item_idYesThe ID of the work item.
expandNoThe 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
  • 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
        }
    ),
  • 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)

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

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