create_work
Generate and manage new work items (issues, tickets) in DevRev by specifying type, title, and applicable part, with optional assignments and details.
Instructions
Create a new work item (issue, ticket) in DevRev
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| applies_to_part | Yes | The DevRev ID of the part to which the work item applies | |
| body | No | ||
| owned_by | No | The DevRev IDs of the users who are assigned to the work item | |
| title | Yes | ||
| type | Yes |
Implementation Reference
- src/devrev_mcp/server.py:600-643 (handler)Handler implementation for the 'create_work' tool. Validates required arguments, constructs payload for DevRev 'works.create' API, handles response or error.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:77-86 (schema)JSON Schema defining the input parameters for the 'create_work' tool, including required fields and properties.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/server.py:74-88 (registration)Registration of the 'create_work' tool in the list_tools() handler, specifying name, description, and input schema.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-39 (helper)Utility function make_devrev_request used by the create_work handler to send POST requests to DevRev API, including authentication via DEVREV_API_KEY.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 )