create_work_item
Create new work items like Epics, User Stories, Tasks, or Bugs in Azure DevOps projects, with support for linking related items to organize development work.
Instructions
Creates a new work item in Azure DevOps. Supports Epic, User Story, Task, Bug, and work item linking.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | The name or ID of the project. | |
| work_item_type | Yes | The type of work item (e.g., 'Bug', 'User Story', 'Task', 'Epic'). | |
| title | Yes | The title of the work item. | |
| description | Yes | The description of the work item. | |
| relations | No | A list of relations to other work items. |
Implementation Reference
- mcp_azure_devops/server.py:903-909 (handler)MCP tool dispatch handler for 'create_work_item' that calls the client method and returns formatted result.elif name == "create_work_item": work_item = self.client.create_work_item(**arguments) return { "id": work_item.id, "url": work_item.url, "title": work_item.fields.get('System.Title', 'N/A') }
- mcp_azure_devops/server.py:60-104 (schema)Input schema definition for the create_work_item tool, defining parameters and validation rules.types.Tool( name="create_work_item", description="Creates a new work item in Azure DevOps. Supports Epic, User Story, Task, Bug, and work item linking.", inputSchema={ "type": "object", "properties": { "project": { "type": "string", "description": "The name or ID of the project." }, "work_item_type": { "type": "string", "description": "The type of work item (e.g., 'Bug', 'User Story', 'Task', 'Epic')." }, "title": { "type": "string", "description": "The title of the work item." }, "description": { "type": "string", "description": "The description of the work item." }, "relations": { "type": "array", "description": "A list of relations to other work items.", "items": { "type": "object", "properties": { "rel": { "type": "string", "description": "The relation type (e.g., 'System.LinkTypes.Dependency-Forward')." }, "url": { "type": "string", "description": "The URL of the related work item." } }, "required": ["rel", "url"] } } }, "required": ["project", "work_item_type", "title", "description"], "additionalProperties": False } ),
- mcp_azure_devops/server.py:857-862 (registration)MCP list_tools handler that registers and returns the list of tools including create_work_item.@self.server.list_tools() async def list_tools() -> List[types.Tool]: """Return the list of available tools.""" logger.info(f"Tools requested - returning {len(self.tools)} tools") self.tools_registered = True return self.tools
- Core helper method in AzureDevOpsClient that implements the work item creation using Azure DevOps SDK JsonPatchOperations.def create_work_item(self, project, work_item_type, title, description, relations=None): patch_document = [ JsonPatchOperation( op="add", path="/fields/System.Title", value=title ), JsonPatchOperation( op="add", path="/fields/System.Description", value=description ) ] if relations: for relation in relations: patch_document.append( JsonPatchOperation( op="add", path="/relations/-", value={ "rel": relation["rel"], "url": relation["url"] } ) ) return self.work_item_tracking_client.create_work_item( document=patch_document, project=project, type=work_item_type )