get_work_item_transitions
Retrieve valid state transitions for Azure DevOps work items to maintain proper workflow compliance when moving between statuses.
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 |
|---|---|---|---|
| project | Yes | The name or ID of the project. | |
| work_item_type | Yes | The work item type (e.g., 'Bug', 'User Story', 'Task'). | |
| from_state | Yes | The current state to get valid transitions from. |
Implementation Reference
- The core handler function that retrieves valid state transitions for a work item type from a specific state using the Azure DevOps API.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 (schema)Input schema definition for the get_work_item_transitions tool, specifying required parameters: project, work_item_type, from_state.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 (registration)Registration and dispatch logic in the MCP server's _execute_tool method, which calls the client handler with unpacked arguments.elif name == "get_work_item_transitions": return self.client.get_work_item_transitions(**arguments)