Skip to content

Reduce fields in search_users response #485

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

Merged
merged 1 commit into from
Jun 6, 2025
Merged

Conversation

SamMorrowDrums
Copy link
Collaborator

There is little use in most of the fields returned by the search_users function, as they are reproducible easily by knowing the user handle, or not relevant. The profile URL is useful as it encourages the LLM to format the handle as a link, which is good, I think.

image

Here is an example showing that the "missing" data is easily re-constructed by the LLM:

image

@Copilot Copilot AI review requested due to automatic review settings June 5, 2025 22:11
@SamMorrowDrums SamMorrowDrums requested a review from a team as a code owner June 5, 2025 22:11
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 streamlines the search_users tool output by returning only essential fields (login, ID, profile URL, avatar URL), injects a type:user filter into the query, and updates the tests to match the new minimal response format.

  • Added MinimalUser and MinimalSearchUsersResult types and conversion logic in search.go
  • Automatically prepended "type:user " to the search query
  • Updated test assertions in search_test.go to use MinimalSearchUsersResult and renamed fields

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/github/search.go Defined minimal response structs, converted full result to minimal, and prefixed "type:user" to queries
pkg/github/search_test.go Switched tests to unmarshal into MinimalSearchUsersResult, updated query expectations and field assertions
Comments suppressed due to low confidence (2)

pkg/github/search.go:152

  • [nitpick] The JSON field profile_url diverges from GitHub’s standard html_url; consider renaming the struct field to HTMLURL with json:"html_url" so consumers familiar with the API won’t be surprised.
ProfileURL string `json:"profile_url,omitempty"`

pkg/github/search.go:149

  • [nitpick] Add a comment above MinimalUser (and similarly for MinimalSearchUsersResult) to explain its purpose and list which fields are intentionally omitted, improving clarity for future maintainers.
type MinimalUser struct {

@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
Copy link
Collaborator Author

@williammartin and @toby I am going ahead with this for reasons I mentioned to Toby last night, but I checked and even if I ask for ordering by follower count we don't get it in the response, so think the published schema is maybe wrong for the search API? Other user APIs might well provide them.

@SamMorrowDrums SamMorrowDrums merged commit 9dd6fc5 into main Jun 6, 2025
16 checks passed
@SamMorrowDrums SamMorrowDrums deleted the cleanup-search-users branch 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