Skip to content

support to fliter issues and tickets based on child parts #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/devrev_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -677,14 +690,21 @@ 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"]
payload["mode"] = cursor["mode"]

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:
Expand Down Expand Up @@ -754,7 +774,7 @@ async def handle_call_tool(
if payload["ticket"] == {}:
payload.pop("ticket")

response = make_devrev_request(
response = make_internal_devrev_request(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is support for filtering on child parts not exposed in the public API? If not, we should add it, should be quick.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It is not exposed in the public API.
  2. Should I make a PR for that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's expose it in the public API and minimise internal API calls here.

"works.list",
payload
)
Expand Down