Skip to content

Commit e749685

Browse files
Anoushka KumarAnoushka Kumar
authored andcommitted
feat: add include_child_parts subfield to applies_to_part in list_works
- Updated list_works tool schema to accept applies_to_part as an object - Added include_child_parts boolean subfield to enable hierarchical part filtering - Updated handler logic to process the new structure and pass to DevRev API - Maintains backward compatibility when include_child_parts is false/not provided
1 parent bdc11c8 commit e749685

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/devrev_mcp/server.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,15 @@ async def handle_list_tools() -> list[types.Tool]:
121121
"required": ["next_cursor", "mode"],
122122
"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."
123123
},
124-
"applies_to_part": {"type": "array", "items": {"type": "string"}, "description": "The part IDs of the works to list"},
124+
"applies_to_part": {
125+
"type": "object",
126+
"properties": {
127+
"part_ids": {"type": "array", "items": {"type": "string"}, "description": "The part IDs of the works to list"},
128+
"include_child_parts": {"type": "boolean", "description": "Whether to include child parts in the search"}
129+
},
130+
"required": ["part_ids"],
131+
"description": "Filter for works by part IDs with option to include child parts"
132+
},
125133
"created_by": {"type": "array", "items": {"type": "string"}, "description": "The user IDs of the creators of the works to list"},
126134
"owned_by": {"type": "array", "items": {"type": "string"}, "description": "The user IDs of the owners of the works to list"},
127135
"state": {"type": "array", "items": {"type": "string", "enum": ["open", "closed", "in_progress"]}, "description": "The state names of the works to list"},
@@ -676,7 +684,14 @@ async def handle_call_tool(
676684

677685
applies_to_part = arguments.get("applies_to_part")
678686
if applies_to_part:
679-
payload["applies_to_part"] = applies_to_part
687+
part_ids = applies_to_part.get("part_ids")
688+
include_child_parts = applies_to_part.get("include_child_parts", False)
689+
690+
if part_ids:
691+
if include_child_parts:
692+
payload["applies_to_part"] = {"parts": part_ids, "include_child_parts": include_child_parts}
693+
else:
694+
payload["applies_to_part"] = part_ids
680695

681696
created_by = arguments.get("created_by")
682697
if created_by:

0 commit comments

Comments
 (0)