create_work
Create new issues or tickets in DevRev to track and manage work items by specifying type, title, and assigned part.
Instructions
Create a new work item (issue, ticket) in DevRev
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | ||
| title | Yes | ||
| body | No | ||
| applies_to_part | Yes | The DevRev ID of the part to which the work item applies | |
| owned_by | No | The DevRev IDs of the users who are assigned to the work item |
Implementation Reference
- src/devrev_mcp/server.py:600-643 (handler)Handler logic for the 'create_work' tool within the handle_call_tool function. Validates input parameters, constructs payload, calls DevRev 'works.create' API via make_devrev_request, and returns success or error message.elif name == "create_work": if not arguments: raise ValueError("Missing arguments") type = arguments.get("type") if not type: raise ValueError("Missing type parameter") title = arguments.get("title") if not title: raise ValueError("Missing title parameter") applies_to_part = arguments.get("applies_to_part") if not applies_to_part: raise ValueError("Missing applies_to_part parameter") body = arguments.get("body", "") owned_by = arguments.get("owned_by", []) response = make_devrev_request( "works.create", { "type": type, "title": title, "body": body, "applies_to_part": applies_to_part, "owned_by": owned_by } ) if response.status_code != 201: error_text = response.text return [ types.TextContent( type="text", text=f"Create object failed with status {response.status_code}: {error_text}" ) ] return [ types.TextContent( type="text", text=f"Object created successfully: {response.json()}" ) ]
- src/devrev_mcp/server.py:74-88 (schema)Input schema and registration of the 'create_work' tool in the list_tools handler, defining parameters, descriptions, and required fields.types.Tool( name="create_work", description="Create a new work item (issue, ticket) in DevRev", inputSchema={ "type": "object", "properties": { "type": {"type": "string", "enum": ["issue", "ticket"]}, "title": {"type": "string"}, "body": {"type": "string"}, "applies_to_part": {"type": "string", "description": "The DevRev ID of the part to which the work item applies"}, "owned_by": {"type": "array", "items": {"type": "string"}, "description": "The DevRev IDs of the users who are assigned to the work item"} }, "required": ["type", "title", "applies_to_part"], }, ),
- src/devrev_mcp/utils.py:12-40 (helper)Utility function make_devrev_request used by the create_work handler to make authenticated POST requests to DevRev API endpoints.def make_devrev_request(endpoint: str, payload: Dict[str, Any]) -> requests.Response: """ Make an authenticated request to the DevRev API. Args: endpoint: The API endpoint path (e.g., "works.get" or "search.hybrid") payload: The JSON payload to send Returns: requests.Response object Raises: ValueError: If DEVREV_API_KEY environment variable is not set """ api_key = os.environ.get("DEVREV_API_KEY") if not api_key: raise ValueError("DEVREV_API_KEY environment variable is not set") headers = { "Authorization": f"{api_key}", "Content-Type": "application/json", } return requests.post( f"https://api.devrev.ai/{endpoint}", headers=headers, json=payload )