From 1fd29840c48f0f5ea6b351361cfbfcc2536a2ec5 Mon Sep 17 00:00:00 2001 From: DevRev Date: Fri, 25 Jul 2025 23:16:15 +0530 Subject: [PATCH] support to fliter issues and tickets based on child parts --- src/devrev_mcp/server.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/devrev_mcp/server.py b/src/devrev_mcp/server.py index d6bfc26..ae3045e 100644 --- a/src/devrev_mcp/server.py +++ b/src/devrev_mcp/server.py @@ -121,7 +121,20 @@ async def handle_list_tools() -> list[types.Tool]: "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." }, - "applies_to_part": {"type": "array", "items": {"type": "string"}, "description": "The part IDs of the works to list"}, + "limit": {"type": "integer", "description": "The maximum number of works to return. Unless specified, keep the limit 10."}, + "applies_to_part": { + "type": "object", + "properties": { + "parts": { + "type": "array", + "items": {"type": "string"}, + "description": "The part IDs of the works to list" + }, + "include_child_parts": {"type": "boolean", "description": "Whether to include child parts in the list of parts to list works for."} + }, + "required": ["parts", "include_child_parts"], + "description": "The parts to list works for. If include_child_parts is true, the child parts of the parts will also be included in the list." + }, "created_by": {"type": "array", "items": {"type": "string"}, "description": "The user IDs of the creators of the works to list"}, "owned_by": {"type": "array", "items": {"type": "string"}, "description": "The user IDs of the owners of the works to list"}, "state": {"type": "array", "items": {"type": "string", "enum": ["open", "closed", "in_progress"]}, "description": "The state names of the works to list"}, @@ -196,7 +209,7 @@ async def handle_list_tools() -> list[types.Tool]: "description": "Use this to filter on sprints." } }, - "required": ["type"], + "required": ["type", "limit"], }, ), types.Tool( @@ -677,6 +690,10 @@ async def handle_call_tool( raise ValueError("Missing type parameter") payload["type"] = type + limit = arguments.get("limit") + if limit: + payload["limit"] = limit + cursor = arguments.get("cursor") if cursor: payload["cursor"] = cursor["next_cursor"] @@ -684,7 +701,10 @@ async def handle_call_tool( applies_to_part = arguments.get("applies_to_part") if applies_to_part: - payload["applies_to_part"] = applies_to_part + if 'ticket' in type: + payload["ticket"]["applies_to_part"] = applies_to_part + elif 'issue' in type: + payload["issue"]["applies_to_part"] = applies_to_part created_by = arguments.get("created_by") if created_by: @@ -754,7 +774,7 @@ async def handle_call_tool( if payload["ticket"] == {}: payload.pop("ticket") - response = make_devrev_request( + response = make_internal_devrev_request( "works.list", payload )