Skip to content

Commit 06655a0

Browse files
refactor: Use ToolsetMetadata directly in NewToolMeta and NewToolsetGroupFromTools
- Move ToolsetMetadata type to toolsets package with alias in github package - Update NewToolMeta to accept ToolsetMetadata instead of string - Update NewToolsetGroupFromTools to accept []ToolsetMetadata slice - Remove need for .ID when calling NewToolMeta (e.g., NewToolMeta(ToolsetMetadataRepos) instead of NewToolMeta(ToolsetMetadataRepos.ID))
1 parent eac0ea7 commit 06655a0

19 files changed

+127
-124
lines changed

pkg/github/actions.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
2929
return mcp.Tool{
3030
Name: "list_workflows",
3131
Description: t("TOOL_LIST_WORKFLOWS_DESCRIPTION", "List workflows in a repository"),
32-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
32+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
3333
Annotations: &mcp.ToolAnnotations{
3434
Title: t("TOOL_LIST_WORKFLOWS_USER_TITLE", "List workflows"),
3535
ReadOnlyHint: true,
@@ -96,7 +96,7 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
9696
return mcp.Tool{
9797
Name: "list_workflow_runs",
9898
Description: t("TOOL_LIST_WORKFLOW_RUNS_DESCRIPTION", "List workflow runs for a specific workflow"),
99-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
99+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
100100
Annotations: &mcp.ToolAnnotations{
101101
Title: t("TOOL_LIST_WORKFLOW_RUNS_USER_TITLE", "List workflow runs"),
102102
ReadOnlyHint: true,
@@ -246,7 +246,7 @@ func RunWorkflow(getClient GetClientFn, t translations.TranslationHelperFunc) (m
246246
return mcp.Tool{
247247
Name: "run_workflow",
248248
Description: t("TOOL_RUN_WORKFLOW_DESCRIPTION", "Run an Actions workflow by workflow ID or filename"),
249-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
249+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
250250
Annotations: &mcp.ToolAnnotations{
251251
Title: t("TOOL_RUN_WORKFLOW_USER_TITLE", "Run workflow"),
252252
ReadOnlyHint: false,
@@ -354,7 +354,7 @@ func GetWorkflowRun(getClient GetClientFn, t translations.TranslationHelperFunc)
354354
return mcp.Tool{
355355
Name: "get_workflow_run",
356356
Description: t("TOOL_GET_WORKFLOW_RUN_DESCRIPTION", "Get details of a specific workflow run"),
357-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
357+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
358358
Annotations: &mcp.ToolAnnotations{
359359
Title: t("TOOL_GET_WORKFLOW_RUN_USER_TITLE", "Get workflow run"),
360360
ReadOnlyHint: true,
@@ -418,7 +418,7 @@ func GetWorkflowRunLogs(getClient GetClientFn, t translations.TranslationHelperF
418418
return mcp.Tool{
419419
Name: "get_workflow_run_logs",
420420
Description: t("TOOL_GET_WORKFLOW_RUN_LOGS_DESCRIPTION", "Download logs for a specific workflow run (EXPENSIVE: downloads ALL logs as ZIP. Consider using get_job_logs with failed_only=true for debugging failed jobs)"),
421-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
421+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
422422
Annotations: &mcp.ToolAnnotations{
423423
Title: t("TOOL_GET_WORKFLOW_RUN_LOGS_USER_TITLE", "Get workflow run logs"),
424424
ReadOnlyHint: true,
@@ -492,7 +492,7 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
492492
return mcp.Tool{
493493
Name: "list_workflow_jobs",
494494
Description: t("TOOL_LIST_WORKFLOW_JOBS_DESCRIPTION", "List jobs for a specific workflow run"),
495-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
495+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
496496
Annotations: &mcp.ToolAnnotations{
497497
Title: t("TOOL_LIST_WORKFLOW_JOBS_USER_TITLE", "List workflow jobs"),
498498
ReadOnlyHint: true,
@@ -588,7 +588,7 @@ func GetJobLogs(getClient GetClientFn, t translations.TranslationHelperFunc, con
588588
return mcp.Tool{
589589
Name: "get_job_logs",
590590
Description: t("TOOL_GET_JOB_LOGS_DESCRIPTION", "Download logs for a specific workflow job or efficiently get all failed job logs for a workflow run"),
591-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
591+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
592592
Annotations: &mcp.ToolAnnotations{
593593
Title: t("TOOL_GET_JOB_LOGS_USER_TITLE", "Get job logs"),
594594
ReadOnlyHint: true,
@@ -849,7 +849,7 @@ func RerunWorkflowRun(getClient GetClientFn, t translations.TranslationHelperFun
849849
return mcp.Tool{
850850
Name: "rerun_workflow_run",
851851
Description: t("TOOL_RERUN_WORKFLOW_RUN_DESCRIPTION", "Re-run an entire workflow run"),
852-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
852+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
853853
Annotations: &mcp.ToolAnnotations{
854854
Title: t("TOOL_RERUN_WORKFLOW_RUN_USER_TITLE", "Rerun workflow run"),
855855
ReadOnlyHint: false,
@@ -920,7 +920,7 @@ func RerunFailedJobs(getClient GetClientFn, t translations.TranslationHelperFunc
920920
return mcp.Tool{
921921
Name: "rerun_failed_jobs",
922922
Description: t("TOOL_RERUN_FAILED_JOBS_DESCRIPTION", "Re-run only the failed jobs in a workflow run"),
923-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
923+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
924924
Annotations: &mcp.ToolAnnotations{
925925
Title: t("TOOL_RERUN_FAILED_JOBS_USER_TITLE", "Rerun failed jobs"),
926926
ReadOnlyHint: false,
@@ -991,7 +991,7 @@ func CancelWorkflowRun(getClient GetClientFn, t translations.TranslationHelperFu
991991
return mcp.Tool{
992992
Name: "cancel_workflow_run",
993993
Description: t("TOOL_CANCEL_WORKFLOW_RUN_DESCRIPTION", "Cancel a workflow run"),
994-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
994+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
995995
Annotations: &mcp.ToolAnnotations{
996996
Title: t("TOOL_CANCEL_WORKFLOW_RUN_USER_TITLE", "Cancel workflow run"),
997997
ReadOnlyHint: false,
@@ -1064,7 +1064,7 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
10641064
return mcp.Tool{
10651065
Name: "list_workflow_run_artifacts",
10661066
Description: t("TOOL_LIST_WORKFLOW_RUN_ARTIFACTS_DESCRIPTION", "List artifacts for a workflow run"),
1067-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
1067+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
10681068
Annotations: &mcp.ToolAnnotations{
10691069
Title: t("TOOL_LIST_WORKFLOW_RUN_ARTIFACTS_USER_TITLE", "List workflow artifacts"),
10701070
ReadOnlyHint: true,
@@ -1140,7 +1140,7 @@ func DownloadWorkflowRunArtifact(getClient GetClientFn, t translations.Translati
11401140
return mcp.Tool{
11411141
Name: "download_workflow_run_artifact",
11421142
Description: t("TOOL_DOWNLOAD_WORKFLOW_RUN_ARTIFACT_DESCRIPTION", "Get download URL for a workflow run artifact"),
1143-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
1143+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
11441144
Annotations: &mcp.ToolAnnotations{
11451145
Title: t("TOOL_DOWNLOAD_WORKFLOW_RUN_ARTIFACT_USER_TITLE", "Download workflow artifact"),
11461146
ReadOnlyHint: true,
@@ -1213,7 +1213,7 @@ func DeleteWorkflowRunLogs(getClient GetClientFn, t translations.TranslationHelp
12131213
return mcp.Tool{
12141214
Name: "delete_workflow_run_logs",
12151215
Description: t("TOOL_DELETE_WORKFLOW_RUN_LOGS_DESCRIPTION", "Delete logs for a workflow run"),
1216-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
1216+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
12171217
Annotations: &mcp.ToolAnnotations{
12181218
Title: t("TOOL_DELETE_WORKFLOW_RUN_LOGS_USER_TITLE", "Delete workflow logs"),
12191219
ReadOnlyHint: false,
@@ -1285,7 +1285,7 @@ func GetWorkflowRunUsage(getClient GetClientFn, t translations.TranslationHelper
12851285
return mcp.Tool{
12861286
Name: "get_workflow_run_usage",
12871287
Description: t("TOOL_GET_WORKFLOW_RUN_USAGE_DESCRIPTION", "Get usage metrics for a workflow run"),
1288-
Meta: NewToolMeta(ToolsetMetadataActions.ID, scopes.Repo),
1288+
Meta: NewToolMeta(ToolsetMetadataActions, scopes.Repo),
12891289
Annotations: &mcp.ToolAnnotations{
12901290
Title: t("TOOL_GET_WORKFLOW_RUN_USAGE_USER_TITLE", "Get workflow usage"),
12911291
ReadOnlyHint: true,

pkg/github/code_scanning.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func GetCodeScanningAlert(getClient GetClientFn, t translations.TranslationHelpe
2020
return mcp.Tool{
2121
Name: "get_code_scanning_alert",
2222
Description: t("TOOL_GET_CODE_SCANNING_ALERT_DESCRIPTION", "Get details of a specific code scanning alert in a GitHub repository."),
23-
Meta: NewToolMeta(ToolsetMetadataCodeSecurity.ID, scopes.SecurityEvents),
23+
Meta: NewToolMeta(ToolsetMetadataCodeSecurity, scopes.SecurityEvents),
2424
Annotations: &mcp.ToolAnnotations{
2525
Title: t("TOOL_GET_CODE_SCANNING_ALERT_USER_TITLE", "Get code scanning alert"),
2626
ReadOnlyHint: true,
@@ -94,7 +94,7 @@ func ListCodeScanningAlerts(getClient GetClientFn, t translations.TranslationHel
9494
return mcp.Tool{
9595
Name: "list_code_scanning_alerts",
9696
Description: t("TOOL_LIST_CODE_SCANNING_ALERTS_DESCRIPTION", "List code scanning alerts in a GitHub repository."),
97-
Meta: NewToolMeta(ToolsetMetadataCodeSecurity.ID, scopes.SecurityEvents),
97+
Meta: NewToolMeta(ToolsetMetadataCodeSecurity, scopes.SecurityEvents),
9898
Annotations: &mcp.ToolAnnotations{
9999
Title: t("TOOL_LIST_CODE_SCANNING_ALERTS_USER_TITLE", "List code scanning alerts"),
100100
ReadOnlyHint: true,

pkg/github/context_tools.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func GetMe(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Too
4141
return mcp.Tool{
4242
Name: "get_me",
4343
Description: t("TOOL_GET_ME_DESCRIPTION", "Get details of the authenticated GitHub user. Use this when a request is about the user's own profile for GitHub. Or when information is missing to build other tool calls."),
44-
Meta: NewToolMeta(ToolsetMetadataContext.ID),
44+
Meta: NewToolMeta(ToolsetMetadataContext),
4545
Annotations: &mcp.ToolAnnotations{
4646
Title: t("TOOL_GET_ME_USER_TITLE", "Get my user profile"),
4747
ReadOnlyHint: true,
@@ -111,7 +111,7 @@ func GetTeams(getClient GetClientFn, getGQLClient GetGQLClientFn, t translations
111111
return mcp.Tool{
112112
Name: "get_teams",
113113
Description: t("TOOL_GET_TEAMS_DESCRIPTION", "Get details of the teams the user is a member of. Limited to organizations accessible with current credentials"),
114-
Meta: NewToolMeta(ToolsetMetadataContext.ID, scopes.ReadOrg),
114+
Meta: NewToolMeta(ToolsetMetadataContext, scopes.ReadOrg),
115115
Annotations: &mcp.ToolAnnotations{
116116
Title: t("TOOL_GET_TEAMS_TITLE", "Get teams"),
117117
ReadOnlyHint: true,
@@ -206,7 +206,7 @@ func GetTeamMembers(getGQLClient GetGQLClientFn, t translations.TranslationHelpe
206206
return mcp.Tool{
207207
Name: "get_team_members",
208208
Description: t("TOOL_GET_TEAM_MEMBERS_DESCRIPTION", "Get member usernames of a specific team in an organization. Limited to organizations accessible with current credentials"),
209-
Meta: NewToolMeta(ToolsetMetadataContext.ID, scopes.ReadOrg),
209+
Meta: NewToolMeta(ToolsetMetadataContext, scopes.ReadOrg),
210210
Annotations: &mcp.ToolAnnotations{
211211
Title: t("TOOL_GET_TEAM_MEMBERS_TITLE", "Get team members"),
212212
ReadOnlyHint: true,

pkg/github/dependabot.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func GetDependabotAlert(getClient GetClientFn, t translations.TranslationHelperF
2020
tool := mcp.Tool{
2121
Name: "get_dependabot_alert",
2222
Description: t("TOOL_GET_DEPENDABOT_ALERT_DESCRIPTION", "Get details of a specific dependabot alert in a GitHub repository."),
23-
Meta: NewToolMeta(ToolsetMetadataDependabot.ID, scopes.SecurityEvents),
23+
Meta: NewToolMeta(ToolsetMetadataDependabot, scopes.SecurityEvents),
2424
Annotations: &mcp.ToolAnnotations{
2525
Title: t("TOOL_GET_DEPENDABOT_ALERT_USER_TITLE", "Get dependabot alert"),
2626
ReadOnlyHint: true,
@@ -97,7 +97,7 @@ func ListDependabotAlerts(getClient GetClientFn, t translations.TranslationHelpe
9797
tool := mcp.Tool{
9898
Name: "list_dependabot_alerts",
9999
Description: t("TOOL_LIST_DEPENDABOT_ALERTS_DESCRIPTION", "List dependabot alerts in a GitHub repository."),
100-
Meta: NewToolMeta(ToolsetMetadataDependabot.ID, scopes.SecurityEvents),
100+
Meta: NewToolMeta(ToolsetMetadataDependabot, scopes.SecurityEvents),
101101
Annotations: &mcp.ToolAnnotations{
102102
Title: t("TOOL_LIST_DEPENDABOT_ALERTS_USER_TITLE", "List dependabot alerts"),
103103
ReadOnlyHint: true,

pkg/github/discussions.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
126126
return mcp.Tool{
127127
Name: "list_discussions",
128128
Description: t("TOOL_LIST_DISCUSSIONS_DESCRIPTION", "List discussions for a repository or organisation."),
129-
Meta: NewToolMeta(ToolsetMetadataDiscussions.ID, scopes.Repo),
129+
Meta: NewToolMeta(ToolsetMetadataDiscussions, scopes.Repo),
130130
Annotations: &mcp.ToolAnnotations{
131131
Title: t("TOOL_LIST_DISCUSSIONS_USER_TITLE", "List discussions"),
132132
ReadOnlyHint: true,
@@ -276,7 +276,7 @@ func GetDiscussion(getGQLClient GetGQLClientFn, t translations.TranslationHelper
276276
return mcp.Tool{
277277
Name: "get_discussion",
278278
Description: t("TOOL_GET_DISCUSSION_DESCRIPTION", "Get a specific discussion by ID"),
279-
Meta: NewToolMeta(ToolsetMetadataDiscussions.ID, scopes.Repo),
279+
Meta: NewToolMeta(ToolsetMetadataDiscussions, scopes.Repo),
280280
Annotations: &mcp.ToolAnnotations{
281281
Title: t("TOOL_GET_DISCUSSION_USER_TITLE", "Get discussion"),
282282
ReadOnlyHint: true,
@@ -377,7 +377,7 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
377377
return mcp.Tool{
378378
Name: "get_discussion_comments",
379379
Description: t("TOOL_GET_DISCUSSION_COMMENTS_DESCRIPTION", "Get comments from a discussion"),
380-
Meta: NewToolMeta(ToolsetMetadataDiscussions.ID, scopes.Repo),
380+
Meta: NewToolMeta(ToolsetMetadataDiscussions, scopes.Repo),
381381
Annotations: &mcp.ToolAnnotations{
382382
Title: t("TOOL_GET_DISCUSSION_COMMENTS_USER_TITLE", "Get discussion comments"),
383383
ReadOnlyHint: true,
@@ -501,7 +501,7 @@ func ListDiscussionCategories(getGQLClient GetGQLClientFn, t translations.Transl
501501
return mcp.Tool{
502502
Name: "list_discussion_categories",
503503
Description: t("TOOL_LIST_DISCUSSION_CATEGORIES_DESCRIPTION", "List discussion categories with their id and name, for a repository or organisation."),
504-
Meta: NewToolMeta(ToolsetMetadataDiscussions.ID, scopes.Repo),
504+
Meta: NewToolMeta(ToolsetMetadataDiscussions, scopes.Repo),
505505
Annotations: &mcp.ToolAnnotations{
506506
Title: t("TOOL_LIST_DISCUSSION_CATEGORIES_USER_TITLE", "List discussion categories"),
507507
ReadOnlyHint: true,

pkg/github/gists.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func ListGists(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp
2020
tool := mcp.Tool{
2121
Name: "list_gists",
2222
Description: t("TOOL_LIST_GISTS_DESCRIPTION", "List gists for a user"),
23-
Meta: NewToolMeta(ToolsetMetadataGists.ID),
23+
Meta: NewToolMeta(ToolsetMetadataGists),
2424
Annotations: &mcp.ToolAnnotations{
2525
Title: t("TOOL_LIST_GISTS", "List Gists"),
2626
ReadOnlyHint: true,
@@ -107,7 +107,7 @@ func GetGist(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.T
107107
tool := mcp.Tool{
108108
Name: "get_gist",
109109
Description: t("TOOL_GET_GIST_DESCRIPTION", "Get gist content of a particular gist, by gist ID"),
110-
Meta: NewToolMeta(ToolsetMetadataGists.ID),
110+
Meta: NewToolMeta(ToolsetMetadataGists),
111111
Annotations: &mcp.ToolAnnotations{
112112
Title: t("TOOL_GET_GIST", "Get Gist Content"),
113113
ReadOnlyHint: true,
@@ -165,7 +165,7 @@ func CreateGist(getClient GetClientFn, t translations.TranslationHelperFunc) (mc
165165
tool := mcp.Tool{
166166
Name: "create_gist",
167167
Description: t("TOOL_CREATE_GIST_DESCRIPTION", "Create a new gist"),
168-
Meta: NewToolMeta(ToolsetMetadataGists.ID, scopes.Gist),
168+
Meta: NewToolMeta(ToolsetMetadataGists, scopes.Gist),
169169
Annotations: &mcp.ToolAnnotations{
170170
Title: t("TOOL_CREATE_GIST", "Create Gist"),
171171
ReadOnlyHint: false,
@@ -268,7 +268,7 @@ func UpdateGist(getClient GetClientFn, t translations.TranslationHelperFunc) (mc
268268
tool := mcp.Tool{
269269
Name: "update_gist",
270270
Description: t("TOOL_UPDATE_GIST_DESCRIPTION", "Update an existing gist"),
271-
Meta: NewToolMeta(ToolsetMetadataGists.ID, scopes.Gist),
271+
Meta: NewToolMeta(ToolsetMetadataGists, scopes.Gist),
272272
Annotations: &mcp.ToolAnnotations{
273273
Title: t("TOOL_UPDATE_GIST", "Update Gist"),
274274
ReadOnlyHint: false,

pkg/github/git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func GetRepositoryTree(getClient GetClientFn, t translations.TranslationHelperFu
4242
tool := mcp.Tool{
4343
Name: "get_repository_tree",
4444
Description: t("TOOL_GET_REPOSITORY_TREE_DESCRIPTION", "Get the tree structure (files and directories) of a GitHub repository at a specific ref or SHA"),
45-
Meta: NewToolMeta(ToolsetMetadataGit.ID, scopes.Repo),
45+
Meta: NewToolMeta(ToolsetMetadataGit, scopes.Repo),
4646
Annotations: &mcp.ToolAnnotations{
4747
Title: t("TOOL_GET_REPOSITORY_TREE_USER_TITLE", "Get repository tree"),
4848
ReadOnlyHint: true,

0 commit comments

Comments
 (0)