-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add support for org-level discussions in list_discussion_categories tool #819
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
Add support for org-level discussions in list_discussion_categories tool #819
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this 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 enhances the list_discussion_categories
tool to support organization-level discussions by making the repo
parameter optional and automatically defaulting to .github
when querying at the organization level.
- Makes the
repo
parameter optional instead of required - Adds logic to default to
.github
repo whenrepo
is not provided for organization-level queries - Updates tool description and documentation to clarify the new behavior
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
pkg/github/discussions.go | Makes repo parameter optional and adds logic to default to .github for org-level queries |
pkg/github/discussions_test.go | Adds comprehensive test coverage for both repository and organization-level scenarios |
README.md | Updates documentation to reflect the optional repo parameter |
Comments suppressed due to low confidence (2)
pkg/github/discussions_test.go:648
- The test verifies that only 'owner' is required but doesn't verify that 'repo' is not in the required array. Consider adding an explicit assertion that 'repo' is not required to make the test more complete.
mockClient := githubv4.NewClient(nil)
toolDef, _ := ListDiscussionCategories(stubGetGQLClientFn(mockClient), translations.NullTranslationHelper)
assert.Equal(t, "list_discussion_categories", toolDef.Name)
assert.NotEmpty(t, toolDef.Description)
assert.Contains(t, toolDef.Description, "or organisation")
assert.Contains(t, toolDef.InputSchema.Properties, "owner")
assert.Contains(t, toolDef.InputSchema.Properties, "repo")
assert.ElementsMatch(t, toolDef.InputSchema.Required, []string{"owner"})
pkg/github/discussions_test.go:733
- Consider adding a test case where
repo
is explicitly set to an empty string to verify the behavior when the parameter is present but empty, as this might behave differently from when the parameter is completely omitted.
name: "list org-level discussion categories (no repo provided)",
reqParams: map[string]interface{}{
"owner": "owner",
// repo is not provided, it will default to ".github"
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test improvements look great 🚀
Overview
Closes: #818
This PR improves the existing
list_discussion_categories
tool, by adding logic to handle organisation-level discussions. (It implements similar logic to what I implemented in PR #775 )Changes introduced
Before, the "repo" argument was required, so when the user would ask to query org-level discussions the model would either (i) hallucinate random values for
repo
or (ii) it would have to know the implementation detail about the Github API which is that org-level discussions are stored in a hidden.github
repo.With these changes:
repo
argument is made optionalrepo
if discussions are to be queried at the org-levelrepo
value is deterministically set to.github
when neededBefore (the model hallucinates repo values)

After (the model correctly omits the repo argument, and the tool uses the deterministic flow to query org-level discussions)
