get_work_item_transitions
Retrieve valid state transitions for Azure DevOps work items to ensure proper workflow progression from a specific state.
Instructions
Get valid state transitions for a work item type from a specific state to ensure proper workflow.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_state | Yes | The current state to get valid transitions from. | |
| project | Yes | The name or ID of the project. | |
| work_item_type | Yes | The work item type (e.g., 'Bug', 'User Story', 'Task'). |
Implementation Reference
- The primary handler function implementing the tool logic: fetches the work item type from Azure DevOps and extracts valid state transitions from the given 'from_state', falling back to all other states if explicit transitions are unavailable.def get_work_item_transitions(self, project, work_item_type, from_state): """ Get valid state transitions for a work item type from a specific state. """ try: # This requires calling the process configuration API # which might not be directly available in the Python SDK # We'll use the work item type to get transition info work_item_type_obj = self.work_item_tracking_client.get_work_item_type( project=project, type=work_item_type ) # Extract transition rules if available transitions = [] if hasattr(work_item_type_obj, 'transitions') and work_item_type_obj.transitions: transitions = [ { "to": getattr(transition, 'to', None), "actions": getattr(transition, 'actions', []) } for transition in work_item_type_obj.transitions if hasattr(transition, 'from') and getattr(transition, 'from', None) == from_state ] else: # Fallback: return all available states as potential transitions if hasattr(work_item_type_obj, 'states') and work_item_type_obj.states: transitions = [ { "to": state.name, "actions": [] } for state in work_item_type_obj.states if state.name != from_state ] return transitions except Exception as e: # Fallback: return empty transitions with error info return {"error": str(e), "transitions": []}
- mcp_azure_devops/server.py:284-306 (registration)Registers the 'get_work_item_transitions' tool with the MCP server, including its description and input schema definition.types.Tool( name="get_work_item_transitions", description="Get valid state transitions for a work item type from a specific state to ensure proper workflow.", inputSchema={ "type": "object", "properties": { "project": { "type": "string", "description": "The name or ID of the project." }, "work_item_type": { "type": "string", "description": "The work item type (e.g., 'Bug', 'User Story', 'Task')." }, "from_state": { "type": "string", "description": "The current state to get valid transitions from." }, }, "required": ["project", "work_item_type", "from_state"], "additionalProperties": False } ),
- mcp_azure_devops/server.py:949-950 (handler)Server-side dispatch handler that routes the tool call to the AzureDevOpsClient's implementation method.elif name == "get_work_item_transitions": return self.client.get_work_item_transitions(**arguments)