Skip to content

Add assignee_id parameter to linear_search_issues tool #922

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions src/codegen/extensions/langchain/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
class ViewFileTool(BaseTool):
"""Tool for viewing file contents and metadata."""

name: ClassVar[str] = "view_file"

Check failure on line 69 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
description: ClassVar[str] = """View the contents and metadata of a file in the codebase.

Check failure on line 70 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
For large files (>500 lines), content will be paginated. Use start_line and end_line to navigate through the file.
The response will indicate if there are more lines available to view."""
args_schema: ClassVar[type[BaseModel]] = ViewFileInput

Check failure on line 73 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
codebase: Codebase = Field(exclude=True)

def __init__(self, codebase: Codebase) -> None:
Expand Down Expand Up @@ -108,9 +108,9 @@
class ListDirectoryTool(BaseTool):
"""Tool for listing directory contents."""

name: ClassVar[str] = "list_directory"

Check failure on line 111 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
description: ClassVar[str] = "List contents of a directory in the codebase"

Check failure on line 112 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
args_schema: ClassVar[type[BaseModel]] = ListDirectoryInput

Check failure on line 113 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
codebase: Codebase = Field(exclude=True)

def __init__(self, codebase: Codebase) -> None:
Expand Down Expand Up @@ -138,9 +138,9 @@
class RipGrepTool(BaseTool):
"""Tool for searching the codebase via RipGrep."""

name: ClassVar[str] = "search"

Check failure on line 141 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
description: ClassVar[str] = "Search the codebase using `ripgrep` or regex pattern matching"

Check failure on line 142 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
args_schema: ClassVar[type[BaseModel]] = SearchInput

Check failure on line 143 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
codebase: Codebase = Field(exclude=True)

def __init__(self, codebase: Codebase) -> None:
Expand All @@ -162,7 +162,7 @@
class EditFileTool(BaseTool):
"""Tool for editing files."""

name: ClassVar[str] = "edit_file"

Check failure on line 165 in src/codegen/extensions/langchain/tools.py

View workflow job for this annotation

GitHub Actions / mypy

error: Cannot override instance variable (previously declared on base class "BaseTool") with class variable [misc]
description: ClassVar[str] = r"""
Edit a file by replacing its entire content. This tool should only be used for replacing entire file contents.
Input for searching the codebase.
Expand Down Expand Up @@ -744,6 +744,7 @@

query: str = Field(..., description="Search query string")
limit: int = Field(default=10, description="Maximum number of issues to return")
assignee_id: str | None = Field(default=None, description="Optional assignee ID to filter issues by")


class LinearSearchIssuesTool(BaseTool):
Expand All @@ -757,8 +758,8 @@
def __init__(self, client: LinearClient) -> None:
super().__init__(client=client)

def _run(self, query: str, limit: int = 10) -> str:
result = linear_search_issues_tool(self.client, query, limit)
def _run(self, query: str, limit: int = 10, assignee_id: str | None = None) -> str:
result = linear_search_issues_tool(self.client, query, limit, assignee_id)
return result.render()


Expand Down
15 changes: 13 additions & 2 deletions src/codegen/extensions/tools/linear/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,19 @@ def linear_register_webhook_tool(
)


def linear_search_issues_tool(client: LinearClient, query: str, limit: int = 10) -> LinearSearchObservation:
"""Search for issues using a query string."""
def linear_search_issues_tool(client: LinearClient, query: str, limit: int = 10, assignee_id: str | None = None) -> LinearSearchObservation:
"""Search for issues using a query string.

Args:
client: LinearClient instance
query: Search query string
limit: Maximum number of issues to return
assignee_id: Optional assignee ID to filter issues by
"""
# If assignee_id is provided and not already in the query, add it
if assignee_id and "assignee:" not in query:
query = f"{query} assignee:{assignee_id}"

try:
issues = client.search_issues(query, limit)
return LinearSearchObservation(
Expand Down