Skip to content

Commit 145357a

Browse files
feat: provide tool annotations
1 parent 495c0cb commit 145357a

15 files changed

+198
-28
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/docker/docker v28.0.4+incompatible
77
github.com/google/go-cmp v0.7.0
88
github.com/google/go-github/v69 v69.2.0
9-
github.com/mark3labs/mcp-go v0.20.1
9+
github.com/mark3labs/mcp-go v0.21.1
1010
github.com/migueleliasweb/go-github-mock v1.1.0
1111
github.com/sirupsen/logrus v1.9.3
1212
github.com/spf13/cobra v1.9.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
5757
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
5858
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
5959
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
60-
github.com/mark3labs/mcp-go v0.20.1 h1:E1Bbx9K8d8kQmDZ1QHblM38c7UU2evQ2LlkANk1U/zw=
61-
github.com/mark3labs/mcp-go v0.20.1/go.mod h1:KmJndYv7GIgcPVwEKJjNcbhVQ+hJGJhrCCB/9xITzpE=
60+
github.com/mark3labs/mcp-go v0.21.1 h1:7Ek6KPIIbMhEYHRiRIg6K6UAgNZCJaHKQp926MNr6V0=
61+
github.com/mark3labs/mcp-go v0.21.1/go.mod h1:KmJndYv7GIgcPVwEKJjNcbhVQ+hJGJhrCCB/9xITzpE=
6262
github.com/migueleliasweb/go-github-mock v1.1.0 h1:GKaOBPsrPGkAKgtfuWY8MclS1xR6MInkx1SexJucMwE=
6363
github.com/migueleliasweb/go-github-mock v1.1.0/go.mod h1:pYe/XlGs4BGMfRY4vmeixVsODHnVDDhJ9zoi0qzSMHc=
6464
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=

pkg/github/code_scanning.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import (
1616
func GetCodeScanningAlert(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
1717
return mcp.NewTool("get_code_scanning_alert",
1818
mcp.WithDescription(t("TOOL_GET_CODE_SCANNING_ALERT_DESCRIPTION", "Get details of a specific code scanning alert in a GitHub repository.")),
19+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
20+
Title: t("TOOL_GET_CODE_SCANNING_ALERT_USER_TITLE", "Get code scanning alert"),
21+
ReadOnlyHint: true,
22+
}),
1923
mcp.WithString("owner",
2024
mcp.Required(),
2125
mcp.Description("The owner of the repository."),
@@ -74,6 +78,10 @@ func GetCodeScanningAlert(getClient GetClientFn, t translations.TranslationHelpe
7478
func ListCodeScanningAlerts(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
7579
return mcp.NewTool("list_code_scanning_alerts",
7680
mcp.WithDescription(t("TOOL_LIST_CODE_SCANNING_ALERTS_DESCRIPTION", "List code scanning alerts in a GitHub repository.")),
81+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
82+
Title: t("TOOL_LIST_CODE_SCANNING_ALERTS_USER_TITLE", "List code scanning alerts"),
83+
ReadOnlyHint: true,
84+
}),
7785
mcp.WithString("owner",
7886
mcp.Required(),
7987
mcp.Description("The owner of the repository."),

pkg/github/context_tools.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import (
1616
func GetMe(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
1717
return mcp.NewTool("get_me",
1818
mcp.WithDescription(t("TOOL_GET_ME_DESCRIPTION", "Get details of the authenticated GitHub user. Use this when a request include \"me\", \"my\"...")),
19+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
20+
Title: t("TOOL_GET_ME_USER_TITLE", "Get my user profile"),
21+
ReadOnlyHint: true,
22+
}),
1923
mcp.WithString("reason",
2024
mcp.Description("Optional: reason the session was created"),
2125
),

pkg/github/dynamic_tools.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ func ToolsetEnum(toolsetGroup *toolsets.ToolsetGroup) mcp.PropertyOption {
2222
func EnableToolset(s *server.MCPServer, toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
2323
return mcp.NewTool("enable_toolset",
2424
mcp.WithDescription(t("TOOL_ENABLE_TOOLSET_DESCRIPTION", "Enable one of the sets of tools the GitHub MCP server provides, use get_toolset_tools and list_available_toolsets first to see what this will enable")),
25+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
26+
Title: t("TOOL_ENABLE_TOOLSET_USER_TITLE", "Enable a toolset"),
27+
// Not modifying GitHub data so no need to show a warning
28+
ReadOnlyHint: true,
29+
}),
2530
mcp.WithString("toolset",
2631
mcp.Required(),
2732
mcp.Description("The name of the toolset to enable"),
@@ -57,6 +62,9 @@ func EnableToolset(s *server.MCPServer, toolsetGroup *toolsets.ToolsetGroup, t t
5762
func ListAvailableToolsets(toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
5863
return mcp.NewTool("list_available_toolsets",
5964
mcp.WithDescription(t("TOOL_LIST_AVAILABLE_TOOLSETS_DESCRIPTION", "List all available toolsets this GitHub MCP server can offer, providing the enabled status of each. Use this when a task could be achieved with a GitHub tool and the currently available tools aren't enough. Call get_toolset_tools with these toolset names to discover specific tools you can call")),
65+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
66+
Title: t("TOOL_LIST_AVAILABLE_TOOLSETS_USER_TITLE", "List available toolsets"),
67+
}),
6068
),
6169
func(_ context.Context, _ mcp.CallToolRequest) (*mcp.CallToolResult, error) {
6270
// We need to convert the toolsetGroup back to a map for JSON serialization
@@ -87,6 +95,9 @@ func ListAvailableToolsets(toolsetGroup *toolsets.ToolsetGroup, t translations.T
8795
func GetToolsetsTools(toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
8896
return mcp.NewTool("get_toolset_tools",
8997
mcp.WithDescription(t("TOOL_GET_TOOLSET_TOOLS_DESCRIPTION", "Lists all the capabilities that are enabled with the specified toolset, use this to get clarity on whether enabling a toolset would help you to complete a task")),
98+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
99+
Title: t("TOOL_GET_TOOLSET_TOOLS_USER_TITLE", "List all tools in a toolset"),
100+
}),
90101
mcp.WithString("toolset",
91102
mcp.Required(),
92103
mcp.Description("The name of the toolset you want to get the tools for"),

pkg/github/issues.go

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import (
1717
// GetIssue creates a tool to get details of a specific issue in a GitHub repository.
1818
func GetIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
1919
return mcp.NewTool("get_issue",
20-
mcp.WithDescription(t("TOOL_GET_ISSUE_DESCRIPTION", "Get details of a specific issue in a GitHub repository")),
20+
mcp.WithDescription(t("TOOL_GET_ISSUE_DESCRIPTION", "Get details of a specific issue in a GitHub repository.")),
21+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
22+
Title: t("TOOL_GET_ISSUE_USER_TITLE", "Get issue details"),
23+
ReadOnlyHint: true,
24+
}),
2125
mcp.WithString("owner",
2226
mcp.Required(),
2327
mcp.Description("The owner of the repository"),
@@ -75,7 +79,11 @@ func GetIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool
7579
// AddIssueComment creates a tool to add a comment to an issue.
7680
func AddIssueComment(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
7781
return mcp.NewTool("add_issue_comment",
78-
mcp.WithDescription(t("TOOL_ADD_ISSUE_COMMENT_DESCRIPTION", "Add a comment to an existing issue")),
82+
mcp.WithDescription(t("TOOL_ADD_ISSUE_COMMENT_DESCRIPTION", "Add a comment to a specific issue in a GitHub repository.")),
83+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
84+
Title: t("TOOL_ADD_ISSUE_COMMENT_USER_TITLE", "Add comment to issue"),
85+
ReadOnlyHint: false,
86+
}),
7987
mcp.WithString("owner",
8088
mcp.Required(),
8189
mcp.Description("Repository owner"),
@@ -145,7 +153,11 @@ func AddIssueComment(getClient GetClientFn, t translations.TranslationHelperFunc
145153
// SearchIssues creates a tool to search for issues and pull requests.
146154
func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
147155
return mcp.NewTool("search_issues",
148-
mcp.WithDescription(t("TOOL_SEARCH_ISSUES_DESCRIPTION", "Search for issues and pull requests across GitHub repositories")),
156+
mcp.WithDescription(t("TOOL_SEARCH_ISSUES_DESCRIPTION", "Search for issues in GitHub repositories.")),
157+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
158+
Title: t("TOOL_SEARCH_ISSUES_USER_TITLE", "Search issues"),
159+
ReadOnlyHint: true,
160+
}),
149161
mcp.WithString("q",
150162
mcp.Required(),
151163
mcp.Description("Search query using GitHub issues search syntax"),
@@ -229,7 +241,11 @@ func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (
229241
// CreateIssue creates a tool to create a new issue in a GitHub repository.
230242
func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
231243
return mcp.NewTool("create_issue",
232-
mcp.WithDescription(t("TOOL_CREATE_ISSUE_DESCRIPTION", "Create a new issue in a GitHub repository")),
244+
mcp.WithDescription(t("TOOL_CREATE_ISSUE_DESCRIPTION", "Create a new issue in a GitHub repository.")),
245+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
246+
Title: t("TOOL_CREATE_ISSUE_USER_TITLE", "Open new issue"),
247+
ReadOnlyHint: false,
248+
}),
233249
mcp.WithString("owner",
234250
mcp.Required(),
235251
mcp.Description("Repository owner"),
@@ -347,7 +363,11 @@ func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
347363
// ListIssues creates a tool to list and filter repository issues
348364
func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
349365
return mcp.NewTool("list_issues",
350-
mcp.WithDescription(t("TOOL_LIST_ISSUES_DESCRIPTION", "List issues in a GitHub repository with filtering options")),
366+
mcp.WithDescription(t("TOOL_LIST_ISSUES_DESCRIPTION", "List issues in a GitHub repository.")),
367+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
368+
Title: t("TOOL_LIST_ISSUES_USER_TITLE", "List issues"),
369+
ReadOnlyHint: true,
370+
}),
351371
mcp.WithString("owner",
352372
mcp.Required(),
353373
mcp.Description("Repository owner"),
@@ -465,7 +485,11 @@ func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (to
465485
// UpdateIssue creates a tool to update an existing issue in a GitHub repository.
466486
func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
467487
return mcp.NewTool("update_issue",
468-
mcp.WithDescription(t("TOOL_UPDATE_ISSUE_DESCRIPTION", "Update an existing issue in a GitHub repository")),
488+
mcp.WithDescription(t("TOOL_UPDATE_ISSUE_DESCRIPTION", "Update an existing issue in a GitHub repository.")),
489+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
490+
Title: t("TOOL_UPDATE_ISSUE_USER_TITLE", "Edit issue"),
491+
ReadOnlyHint: false,
492+
}),
469493
mcp.WithString("owner",
470494
mcp.Required(),
471495
mcp.Description("Repository owner"),
@@ -607,7 +631,11 @@ func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
607631
// GetIssueComments creates a tool to get comments for a GitHub issue.
608632
func GetIssueComments(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
609633
return mcp.NewTool("get_issue_comments",
610-
mcp.WithDescription(t("TOOL_GET_ISSUE_COMMENTS_DESCRIPTION", "Get comments for a GitHub issue")),
634+
mcp.WithDescription(t("TOOL_GET_ISSUE_COMMENTS_DESCRIPTION", "Get comments for a specific issue in a GitHub repository.")),
635+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
636+
Title: t("TOOL_GET_ISSUE_COMMENTS_USER_TITLE", "Get issue comments"),
637+
ReadOnlyHint: true,
638+
}),
611639
mcp.WithString("owner",
612640
mcp.Required(),
613641
mcp.Description("Repository owner"),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy