list_parts
Retrieve all enhancements in DevRev with filters for owners, dates, accounts, and sorting options to manage product improvements.
Instructions
List all parts (enhancements) in DevRev
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | The type of parts to list | |
| cursor | No | The cursor to use for pagination. If not provided, iteration begins from the first page. In the output you get next_cursor, use it and the correct mode to get the next or previous page. You can use these to loop through all the pages. | |
| owned_by | No | The DevRev IDs of the users assigned to the parts to list | |
| parent_part | No | The DevRev IDs of the parent parts to of the parts to list | |
| created_by | No | The DevRev IDs of the users who created the parts to list | |
| modified_by | No | The DevRev IDs of the users who modified the parts to list | |
| sort_by | No | The field (and the order) to sort the parts by, in the sequence of the array elements | |
| accounts | No | The account IDs of the accounts filter on parts to list | |
| target_close_date | No | ||
| target_start_date | No | ||
| actual_close_date | No | ||
| actual_start_date | No |
Implementation Reference
- src/devrev_mcp/server.py:976-1060 (handler)The handler logic for executing the 'list_parts' tool. It parses arguments, builds a payload for the DevRev API 'parts.list' endpoint, makes the request using make_devrev_request, and returns the results or error.elif name == "list_parts": if not arguments: raise ValueError("Missing arguments") payload = {} payload["enhancement"] = {} type = arguments.get("type") if not type: raise ValueError("Missing type parameter") payload["type"] = type cursor = arguments.get("cursor") if cursor: payload["cursor"] = cursor["next_cursor"] payload["mode"] = cursor["mode"] owned_by = arguments.get("owned_by") if owned_by: payload["owned_by"] = owned_by parent_part = arguments.get("parent_part") if parent_part: payload["parent_part"] = {"parts": parent_part} created_by = arguments.get("created_by") if created_by: payload["created_by"] = created_by modified_by = arguments.get("modified_by") if modified_by: payload["modified_by"] = modified_by sort_by = arguments.get("sort_by") if sort_by: payload["sort_by"] = sort_by accounts = arguments.get("accounts") if accounts: if 'enhancement' in type: payload["enhancement"]["accounts"] = accounts target_close_date = arguments.get("target_close_date") if target_close_date: if 'enhancement' in type: payload["enhancement"]["target_close_date"] = {"after": target_close_date["after"], "before": target_close_date["before"]} target_start_date = arguments.get("target_start_date") if target_start_date: if 'enhancement' in type: payload["enhancement"]["target_start_date"] = {"after": target_start_date["after"], "before": target_start_date["before"]} actual_close_date = arguments.get("actual_close_date") if actual_close_date: if 'enhancement' in type: payload["enhancement"]["actual_close_date"] = {"after": actual_close_date["after"], "before": actual_close_date["before"]} actual_start_date = arguments.get("actual_start_date") if actual_start_date: if 'enhancement' in type: payload["enhancement"]["actual_start_date"] = {"after": actual_start_date["after"], "before": actual_start_date["before"]} if payload["enhancement"] == {}: payload.pop("enhancement") response = make_devrev_request( "parts.list", payload ) if response.status_code != 200: error_text = response.text return [ types.TextContent( type="text", text=f"List parts failed with status {response.status_code}: {error_text}" ) ] return [ types.TextContent( type="text", text=f"Parts listed successfully: {response.json()}" ) ]
- src/devrev_mcp/server.py:272-329 (registration)The registration of the 'list_parts' tool in the list_tools handler, including its name, description, and detailed input schema for parameters like type, cursor, filters, and date ranges.types.Tool( name="list_parts", description="List all parts (enhancements) in DevRev", inputSchema={ "type": "object", "properties": { "type": {"type": "string", "enum": ["enhancement"], "description": "The type of parts to list"}, "cursor": { "type": "object", "properties": { "next_cursor": {"type": "string", "description": "The cursor to use for pagination. If not provided, iteration begins from the first page."}, "mode": {"type": "string", "enum": ["after", "before"], "description": "The mode to iterate after the cursor or before the cursor ."}, }, "required": ["next_cursor", "mode"], "description": "The cursor to use for pagination. If not provided, iteration begins from the first page. In the output you get next_cursor, use it and the correct mode to get the next or previous page. You can use these to loop through all the pages." }, "owned_by": {"type": "array", "items": {"type": "string"}, "description": "The DevRev IDs of the users assigned to the parts to list"}, "parent_part": {"type": "array", "items": {"type": "string"}, "description": "The DevRev IDs of the parent parts to of the parts to list"}, "created_by": {"type": "array", "items": {"type": "string"}, "description": "The DevRev IDs of the users who created the parts to list"}, "modified_by": {"type": "array", "items": {"type": "string"}, "description": "The DevRev IDs of the users who modified the parts to list"}, "sort_by": {"type": "array", "items": {"type": "string", "enum": ["target_close_date:asc", "target_close_date:desc", "target_start_date:asc", "target_start_date:desc", "actual_close_date:asc", "actual_close_date:desc", "actual_start_date:asc", "actual_start_date:desc", "created_date:asc", "created_date:desc", "modified_date:asc", "modified_date:desc"]}, "description": "The field (and the order) to sort the parts by, in the sequence of the array elements"}, "accounts": {"type": "array", "items": {"type": "string"}, "description": "The account IDs of the accounts filter on parts to list"}, "target_close_date": { "type": "object", "properties": { "after": {"type": "string", "description": "The start date of the target close date range, for example: 2025-06-03T00:00:00Z"}, "before": {"type": "string", "description": "The end date of the target close date range, for example: 2025-06-03T00:00:00Z"}, }, "required": ["after", "before"] }, "target_start_date": { "type": "object", "properties": { "after": {"type": "string", "description": "The start date of the target start date range, for example: 2025-06-03T00:00:00Z"}, "before": {"type": "string", "description": "The end date of the target start date range, for example: 2025-06-03T00:00:00Z"}, }, "required": ["after", "before"] }, "actual_close_date": { "type": "object", "properties": { "after": {"type": "string", "description": "The start date of the actual close date range, for example: 2025-06-03T00:00:00Z"}, "before": {"type": "string", "description": "The end date of the actual close date range, for example: 2025-06-03T00:00:00Z"}, }, "required": ["after", "before"] }, "actual_start_date": { "type": "object", "properties": { "after": {"type": "string", "description": "The start date of the actual start date range, for example: 2025-06-03T00:00:00Z"}, "before": {"type": "string", "description": "The end date of the actual start date range, for example: 2025-06-03T00:00:00Z"}, }, "required": ["after", "before"] }, }, "required": ["type"], }, ),
- src/devrev_mcp/utils.py:12-40 (helper)Utility function make_devrev_request used by the list_parts handler to send POST requests to DevRev API endpoints with authentication.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 )