Skip to content

Separate org and user search #486

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 3 commits into
base: main
Choose a base branch
from
Open

Separate org and user search #486

wants to merge 3 commits into from

Conversation

SamMorrowDrums
Copy link
Collaborator

In order to make separation of certain objects more clear we should separate them. This means orgs and users are not the same.

A follow-up will be to separate issue and PR search by also scoping the queries and producing separate functions. It is best for the LLM that it has clear boundaries, and concepts are consistent, rather than accepting the legacy API quirks.

@Copilot Copilot AI review requested due to automatic review settings June 5, 2025 22:13
@SamMorrowDrums SamMorrowDrums requested a review from a team as a code owner June 5, 2025 22:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR separates organization searches from user searches by introducing dedicated tools and refactoring common logic.

  • Registers a new orgs toolset in InitToolsets.
  • Refactors search handlers with userOrOrgHandler and adds a (currently unused) minimalAccountSearchHandler.
  • Implements SearchOrgs function and its tests in search_test.go.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pkg/github/tools.go Added and registered "orgs" toolset alongside existing toolsets
pkg/github/search.go Refactored search logic, added userOrOrgHandler, SearchOrgs, and residual minimalAccountSearchHandler
pkg/github/search_test.go Added Test_SearchOrgs suite to validate organization search tool
Comments suppressed due to low confidence (3)

pkg/github/search.go:163

  • The minimalAccountSearchHandler function is never used. Consider removing it or integrating it into the userOrOrgHandler to avoid dead code.
func minimalAccountSearchHandler(accountType string, query string, getClient GetClientFn, ctx context.Context, sort, order string, pagination PaginationParams) {

pkg/github/search.go:335

  • [nitpick] The translation key TOOL_SEARCH_ORGS_USER_TITLE includes USER although this is for organizations; consider renaming it to TOOL_SEARCH_ORGS_TITLE for consistency.
mcp.WithToolAnnotation(mcp.ToolAnnotation{ Title: t("TOOL_SEARCH_ORGS_USER_TITLE", "Search organizations"),

pkg/github/search_test.go:521

  • [nitpick] Tests for SearchOrgs cover the default pagination but don’t verify behavior when non-default sort, order, or pagination parameters are provided. Consider adding cases to cover those parameters.
requestArgs: map[string]interface{}{

@SamMorrowDrums SamMorrowDrums force-pushed the cleanup-search-users branch from 1495115 to 52d0bf0 Compare June 5, 2025 22:20
@SamMorrowDrums SamMorrowDrums force-pushed the cleanup-search-users branch from 52d0bf0 to 6c70992 Compare June 5, 2025 22:21
@SamMorrowDrums SamMorrowDrums force-pushed the search_orgs branch 2 times, most recently from 6168095 to caea5e0 Compare June 5, 2025 22:25
Base automatically changed from cleanup-search-users to main June 6, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant