From 29969a86ab14638423b74a0cc7d02b40010dfa37 Mon Sep 17 00:00:00 2001 From: tonytrg Date: Tue, 15 Apr 2025 11:06:20 +0200 Subject: [PATCH 1/3] Add missing enum constraints --- pkg/github/code_scanning.go | 6 ++++-- pkg/github/pullrequests.go | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/github/code_scanning.go b/pkg/github/code_scanning.go index 4fc029bf..09a56ed4 100644 --- a/pkg/github/code_scanning.go +++ b/pkg/github/code_scanning.go @@ -86,11 +86,13 @@ func ListCodeScanningAlerts(getClient GetClientFn, t translations.TranslationHel mcp.Description("The Git reference for the results you want to list."), ), mcp.WithString("state", - mcp.Description("State of the code scanning alerts to list. Set to closed to list only closed code scanning alerts. Default: open"), + mcp.Description("Filter code scanning alerts by state ('open', 'closed', 'dismissed', 'fixed'). Default: open"), mcp.DefaultString("open"), + mcp.Enum("open", "closed", "dismissed", "fixed"), ), mcp.WithString("severity", - mcp.Description("Only code scanning alerts with this severity will be returned. Possible values are: critical, high, medium, low, warning, note, error."), + mcp.Description("If provided, filter code scanning alerts by severity ('critical', 'high', 'medium', 'low', 'warning', 'note', 'error')"), + mcp.Enum("critical", "high", "medium", "low", "warning", "note", "error"), ), ), func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index fd9420d7..08cf7132 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -202,6 +202,7 @@ func ListPullRequests(getClient GetClientFn, t translations.TranslationHelperFun ), mcp.WithString("state", mcp.Description("Filter by state ('open', 'closed', 'all')"), + mcp.Enum("open", "closed", "all"), ), mcp.WithString("head", mcp.Description("Filter by head user/org and branch"), @@ -211,6 +212,7 @@ func ListPullRequests(getClient GetClientFn, t translations.TranslationHelperFun ), mcp.WithString("sort", mcp.Description("Sort by ('created', 'updated', 'popularity', 'long-running')"), + mcp.Enum("created", "updated", "popularity", "long-running"), ), mcp.WithString("direction", mcp.Description("Sort direction ('asc', 'desc')"), @@ -314,6 +316,7 @@ func MergePullRequest(getClient GetClientFn, t translations.TranslationHelperFun ), mcp.WithString("merge_method", mcp.Description("Merge method ('merge', 'squash', 'rebase')"), + mcp.Enum("merge", "squash", "rebase"), ), ), func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { @@ -671,21 +674,21 @@ func AddPullRequestReviewComment(getClient GetClientFn, t translations.Translati mcp.Description("The relative path to the file that necessitates a comment. Required unless in_reply_to is specified."), ), mcp.WithString("subject_type", - mcp.Description("The level at which the comment is targeted, 'line' or 'file'"), + mcp.Description("The level at which the comment is targeted ('line', 'file')"), mcp.Enum("line", "file"), ), mcp.WithNumber("line", mcp.Description("The line of the blob in the pull request diff that the comment applies to. For multi-line comments, the last line of the range"), ), mcp.WithString("side", - mcp.Description("The side of the diff to comment on. Can be LEFT or RIGHT"), + mcp.Description("The side of the diff to comment on ('LEFT', 'RIGHT')"), mcp.Enum("LEFT", "RIGHT"), ), mcp.WithNumber("start_line", mcp.Description("For multi-line comments, the first line of the range that the comment applies to"), ), mcp.WithString("start_side", - mcp.Description("For multi-line comments, the starting side of the diff that the comment applies to. Can be LEFT or RIGHT"), + mcp.Description("For multi-line comments, the starting side of the diff that the comment applies to ('LEFT', 'RIGHT')"), mcp.Enum("LEFT", "RIGHT"), ), mcp.WithNumber("in_reply_to", @@ -894,6 +897,7 @@ func CreatePullRequestReview(getClient GetClientFn, t translations.TranslationHe mcp.WithString("event", mcp.Required(), mcp.Description("Review action ('APPROVE', 'REQUEST_CHANGES', 'COMMENT')"), + mcp.Enum("APPROVE", "REQUEST_CHANGES", "COMMENT"), ), mcp.WithString("commitId", mcp.Description("SHA of commit to review"), From 5a7d13c874365aebbd4b1d370cc2cb451386ee79 Mon Sep 17 00:00:00 2001 From: tonytrg Date: Tue, 15 Apr 2025 16:41:30 +0200 Subject: [PATCH 2/3] Remove redundant listing of additional enums in descriptions --- pkg/github/code_scanning.go | 4 ++-- pkg/github/issues.go | 14 +++++++------- pkg/github/pullrequests.go | 19 ++++++++++--------- pkg/github/repositories.go | 2 +- pkg/github/search.go | 6 +++--- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/pkg/github/code_scanning.go b/pkg/github/code_scanning.go index 09a56ed4..5dbac0d5 100644 --- a/pkg/github/code_scanning.go +++ b/pkg/github/code_scanning.go @@ -86,12 +86,12 @@ func ListCodeScanningAlerts(getClient GetClientFn, t translations.TranslationHel mcp.Description("The Git reference for the results you want to list."), ), mcp.WithString("state", - mcp.Description("Filter code scanning alerts by state ('open', 'closed', 'dismissed', 'fixed'). Default: open"), + mcp.Description("Filter code scanning alerts by state. Defaults to open"), mcp.DefaultString("open"), mcp.Enum("open", "closed", "dismissed", "fixed"), ), mcp.WithString("severity", - mcp.Description("If provided, filter code scanning alerts by severity ('critical', 'high', 'medium', 'low', 'warning', 'note', 'error')"), + mcp.Description("Filter code scanning alerts by severity"), mcp.Enum("critical", "high", "medium", "low", "warning", "note", "error"), ), ), diff --git a/pkg/github/issues.go b/pkg/github/issues.go index 16c34141..1324bd56 100644 --- a/pkg/github/issues.go +++ b/pkg/github/issues.go @@ -90,7 +90,7 @@ func AddIssueComment(getClient GetClientFn, t translations.TranslationHelperFunc ), mcp.WithString("body", mcp.Required(), - mcp.Description("Comment text"), + mcp.Description("Comment content"), ), ), func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { @@ -151,7 +151,7 @@ func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) ( mcp.Description("Search query using GitHub issues search syntax"), ), mcp.WithString("sort", - mcp.Description("Sort field (comments, reactions, created, etc.)"), + mcp.Description("Sort field by number of matches of categories, defaults to best match"), mcp.Enum( "comments", "reactions", @@ -167,7 +167,7 @@ func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) ( ), ), mcp.WithString("order", - mcp.Description("Sort order ('asc' or 'desc')"), + mcp.Description("Sort order"), mcp.Enum("asc", "desc"), ), WithPagination(), @@ -357,7 +357,7 @@ func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (to mcp.Description("Repository name"), ), mcp.WithString("state", - mcp.Description("Filter by state ('open', 'closed', 'all')"), + mcp.Description("Filter by state"), mcp.Enum("open", "closed", "all"), ), mcp.WithArray("labels", @@ -369,11 +369,11 @@ func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (to ), ), mcp.WithString("sort", - mcp.Description("Sort by ('created', 'updated', 'comments')"), + mcp.Description("Sort order"), mcp.Enum("created", "updated", "comments"), ), mcp.WithString("direction", - mcp.Description("Sort direction ('asc', 'desc')"), + mcp.Description("Sort direction"), mcp.Enum("asc", "desc"), ), mcp.WithString("since", @@ -485,7 +485,7 @@ func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t mcp.Description("New description"), ), mcp.WithString("state", - mcp.Description("New state ('open' or 'closed')"), + mcp.Description("New state"), mcp.Enum("open", "closed"), ), mcp.WithArray("labels", diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index 08cf7132..b2f047df 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -94,7 +94,7 @@ func UpdatePullRequest(getClient GetClientFn, t translations.TranslationHelperFu mcp.Description("New description"), ), mcp.WithString("state", - mcp.Description("New state ('open' or 'closed')"), + mcp.Description("New state"), mcp.Enum("open", "closed"), ), mcp.WithString("base", @@ -201,7 +201,7 @@ func ListPullRequests(getClient GetClientFn, t translations.TranslationHelperFun mcp.Description("Repository name"), ), mcp.WithString("state", - mcp.Description("Filter by state ('open', 'closed', 'all')"), + mcp.Description("Filter by state"), mcp.Enum("open", "closed", "all"), ), mcp.WithString("head", @@ -211,11 +211,12 @@ func ListPullRequests(getClient GetClientFn, t translations.TranslationHelperFun mcp.Description("Filter by base branch"), ), mcp.WithString("sort", - mcp.Description("Sort by ('created', 'updated', 'popularity', 'long-running')"), + mcp.Description("Sort by category"), mcp.Enum("created", "updated", "popularity", "long-running"), ), mcp.WithString("direction", - mcp.Description("Sort direction ('asc', 'desc')"), + mcp.Description("Sort direction"), + mcp.Enum("asc", "desc"), ), WithPagination(), ), @@ -315,7 +316,7 @@ func MergePullRequest(getClient GetClientFn, t translations.TranslationHelperFun mcp.Description("Extra detail for merge commit"), ), mcp.WithString("merge_method", - mcp.Description("Merge method ('merge', 'squash', 'rebase')"), + mcp.Description("Merge method"), mcp.Enum("merge", "squash", "rebase"), ), ), @@ -674,21 +675,21 @@ func AddPullRequestReviewComment(getClient GetClientFn, t translations.Translati mcp.Description("The relative path to the file that necessitates a comment. Required unless in_reply_to is specified."), ), mcp.WithString("subject_type", - mcp.Description("The level at which the comment is targeted ('line', 'file')"), + mcp.Description("The level at which the comment is targeted"), mcp.Enum("line", "file"), ), mcp.WithNumber("line", mcp.Description("The line of the blob in the pull request diff that the comment applies to. For multi-line comments, the last line of the range"), ), mcp.WithString("side", - mcp.Description("The side of the diff to comment on ('LEFT', 'RIGHT')"), + mcp.Description("The side of the diff to comment on"), mcp.Enum("LEFT", "RIGHT"), ), mcp.WithNumber("start_line", mcp.Description("For multi-line comments, the first line of the range that the comment applies to"), ), mcp.WithString("start_side", - mcp.Description("For multi-line comments, the starting side of the diff that the comment applies to ('LEFT', 'RIGHT')"), + mcp.Description("For multi-line comments, the starting side of the diff that the comment applies to"), mcp.Enum("LEFT", "RIGHT"), ), mcp.WithNumber("in_reply_to", @@ -896,7 +897,7 @@ func CreatePullRequestReview(getClient GetClientFn, t translations.TranslationHe ), mcp.WithString("event", mcp.Required(), - mcp.Description("Review action ('APPROVE', 'REQUEST_CHANGES', 'COMMENT')"), + mcp.Description("Review action to perform"), mcp.Enum("APPROVE", "REQUEST_CHANGES", "COMMENT"), ), mcp.WithString("commitId", diff --git a/pkg/github/repositories.go b/pkg/github/repositories.go index 1d74dcfb..51948730 100644 --- a/pkg/github/repositories.go +++ b/pkg/github/repositories.go @@ -93,7 +93,7 @@ func ListCommits(getClient GetClientFn, t translations.TranslationHelperFunc) (t mcp.Description("Repository name"), ), mcp.WithString("sha", - mcp.Description("Branch name"), + mcp.Description("SHA or Branch name"), ), WithPagination(), ), diff --git a/pkg/github/search.go b/pkg/github/search.go index 75810e24..dc85c177 100644 --- a/pkg/github/search.go +++ b/pkg/github/search.go @@ -78,7 +78,7 @@ func SearchCode(getClient GetClientFn, t translations.TranslationHelperFunc) (to mcp.Description("Sort field ('indexed' only)"), ), mcp.WithString("order", - mcp.Description("Sort order ('asc' or 'desc')"), + mcp.Description("Sort order"), mcp.Enum("asc", "desc"), ), WithPagination(), @@ -147,11 +147,11 @@ func SearchUsers(getClient GetClientFn, t translations.TranslationHelperFunc) (t mcp.Description("Search query using GitHub users search syntax"), ), mcp.WithString("sort", - mcp.Description("Sort field (followers, repositories, joined)"), + mcp.Description("Sort field by category"), mcp.Enum("followers", "repositories", "joined"), ), mcp.WithString("order", - mcp.Description("Sort order ('asc' or 'desc')"), + mcp.Description("Sort order"), mcp.Enum("asc", "desc"), ), WithPagination(), From 41b599312b72918a125782d7868c65008e014ce1 Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Tue, 15 Apr 2025 17:00:53 +0200 Subject: [PATCH 3/3] Update pkg/github/pullrequests.go --- pkg/github/pullrequests.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index b2f047df..2be249c8 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -211,7 +211,7 @@ func ListPullRequests(getClient GetClientFn, t translations.TranslationHelperFun mcp.Description("Filter by base branch"), ), mcp.WithString("sort", - mcp.Description("Sort by category"), + mcp.Description("Sort by"), mcp.Enum("created", "updated", "popularity", "long-running"), ), mcp.WithString("direction",