Skip to content

Commit 41077cf

Browse files
feat: provide tool annotations
1 parent 495c0cb commit 41077cf

15 files changed

+152
-28
lines changed

go.mod

+1-1
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

+2-2
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

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ 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+
}),
1922
mcp.WithString("owner",
2023
mcp.Required(),
2124
mcp.Description("The owner of the repository."),
@@ -74,6 +77,9 @@ func GetCodeScanningAlert(getClient GetClientFn, t translations.TranslationHelpe
7477
func ListCodeScanningAlerts(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
7578
return mcp.NewTool("list_code_scanning_alerts",
7679
mcp.WithDescription(t("TOOL_LIST_CODE_SCANNING_ALERTS_DESCRIPTION", "List code scanning alerts in a GitHub repository.")),
80+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
81+
Title: t("TOOL_LIST_CODE_SCANNING_ALERTS_USER_TITLE", "List code scanning alerts"),
82+
}),
7783
mcp.WithString("owner",
7884
mcp.Required(),
7985
mcp.Description("The owner of the repository."),

pkg/github/context_tools.go

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ 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", "Fetch my user profile"),
21+
}),
1922
mcp.WithString("reason",
2023
mcp.Description("Optional: reason the session was created"),
2124
),

pkg/github/dynamic_tools.go

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ 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+
}),
2528
mcp.WithString("toolset",
2629
mcp.Required(),
2730
mcp.Description("The name of the toolset to enable"),
@@ -57,6 +60,9 @@ func EnableToolset(s *server.MCPServer, toolsetGroup *toolsets.ToolsetGroup, t t
5760
func ListAvailableToolsets(toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
5861
return mcp.NewTool("list_available_toolsets",
5962
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")),
63+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
64+
Title: t("TOOL_LIST_AVAILABLE_TOOLSETS_USER_TITLE", "List available toolsets"),
65+
}),
6066
),
6167
func(_ context.Context, _ mcp.CallToolRequest) (*mcp.CallToolResult, error) {
6268
// We need to convert the toolsetGroup back to a map for JSON serialization
@@ -87,6 +93,9 @@ func ListAvailableToolsets(toolsetGroup *toolsets.ToolsetGroup, t translations.T
8793
func GetToolsetsTools(toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
8894
return mcp.NewTool("get_toolset_tools",
8995
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")),
96+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
97+
Title: t("TOOL_GET_TOOLSET_TOOLS_USER_TITLE", "List all tools in a toolset"),
98+
}),
9099
mcp.WithString("toolset",
91100
mcp.Required(),
92101
mcp.Description("The name of the toolset you want to get the tools for"),

pkg/github/issues.go

+28-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ 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+
}),
2124
mcp.WithString("owner",
2225
mcp.Required(),
2326
mcp.Description("The owner of the repository"),
@@ -75,7 +78,10 @@ func GetIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool
7578
// AddIssueComment creates a tool to add a comment to an issue.
7679
func AddIssueComment(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
7780
return mcp.NewTool("add_issue_comment",
78-
mcp.WithDescription(t("TOOL_ADD_ISSUE_COMMENT_DESCRIPTION", "Add a comment to an existing issue")),
81+
mcp.WithDescription(t("TOOL_ADD_ISSUE_COMMENT_DESCRIPTION", "Add a comment to a specific issue in a GitHub repository.")),
82+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
83+
Title: t("TOOL_ADD_ISSUE_COMMENT_USER_TITLE", "Add comment to issue"),
84+
}),
7985
mcp.WithString("owner",
8086
mcp.Required(),
8187
mcp.Description("Repository owner"),
@@ -145,7 +151,10 @@ func AddIssueComment(getClient GetClientFn, t translations.TranslationHelperFunc
145151
// SearchIssues creates a tool to search for issues and pull requests.
146152
func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
147153
return mcp.NewTool("search_issues",
148-
mcp.WithDescription(t("TOOL_SEARCH_ISSUES_DESCRIPTION", "Search for issues and pull requests across GitHub repositories")),
154+
mcp.WithDescription(t("TOOL_SEARCH_ISSUES_DESCRIPTION", "Search for issues in GitHub repositories.")),
155+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
156+
Title: t("TOOL_SEARCH_ISSUES_USER_TITLE", "Search issues"),
157+
}),
149158
mcp.WithString("q",
150159
mcp.Required(),
151160
mcp.Description("Search query using GitHub issues search syntax"),
@@ -229,7 +238,10 @@ func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (
229238
// CreateIssue creates a tool to create a new issue in a GitHub repository.
230239
func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
231240
return mcp.NewTool("create_issue",
232-
mcp.WithDescription(t("TOOL_CREATE_ISSUE_DESCRIPTION", "Create a new issue in a GitHub repository")),
241+
mcp.WithDescription(t("TOOL_CREATE_ISSUE_DESCRIPTION", "Create a new issue in a GitHub repository.")),
242+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
243+
Title: t("TOOL_CREATE_ISSUE_USER_TITLE", "Open new issue"),
244+
}),
233245
mcp.WithString("owner",
234246
mcp.Required(),
235247
mcp.Description("Repository owner"),
@@ -347,7 +359,10 @@ func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
347359
// ListIssues creates a tool to list and filter repository issues
348360
func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
349361
return mcp.NewTool("list_issues",
350-
mcp.WithDescription(t("TOOL_LIST_ISSUES_DESCRIPTION", "List issues in a GitHub repository with filtering options")),
362+
mcp.WithDescription(t("TOOL_LIST_ISSUES_DESCRIPTION", "List issues in a GitHub repository.")),
363+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
364+
Title: t("TOOL_LIST_ISSUES_USER_TITLE", "List issues"),
365+
}),
351366
mcp.WithString("owner",
352367
mcp.Required(),
353368
mcp.Description("Repository owner"),
@@ -465,7 +480,10 @@ func ListIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (to
465480
// UpdateIssue creates a tool to update an existing issue in a GitHub repository.
466481
func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
467482
return mcp.NewTool("update_issue",
468-
mcp.WithDescription(t("TOOL_UPDATE_ISSUE_DESCRIPTION", "Update an existing issue in a GitHub repository")),
483+
mcp.WithDescription(t("TOOL_UPDATE_ISSUE_DESCRIPTION", "Update an existing issue in a GitHub repository.")),
484+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
485+
Title: t("TOOL_UPDATE_ISSUE_USER_TITLE", "Edit issue"),
486+
}),
469487
mcp.WithString("owner",
470488
mcp.Required(),
471489
mcp.Description("Repository owner"),
@@ -607,7 +625,10 @@ func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
607625
// GetIssueComments creates a tool to get comments for a GitHub issue.
608626
func GetIssueComments(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
609627
return mcp.NewTool("get_issue_comments",
610-
mcp.WithDescription(t("TOOL_GET_ISSUE_COMMENTS_DESCRIPTION", "Get comments for a GitHub issue")),
628+
mcp.WithDescription(t("TOOL_GET_ISSUE_COMMENTS_DESCRIPTION", "Get comments for a specific issue in a GitHub repository.")),
629+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
630+
Title: t("TOOL_GET_ISSUE_COMMENTS_USER_TITLE", "Get issue comments"),
631+
}),
611632
mcp.WithString("owner",
612633
mcp.Required(),
613634
mcp.Description("Repository owner"),

0 commit comments

Comments
 (0)