8000 feat: enhance GitHub Actions toolset with additional workflow managem… · github/github-mcp-server@9153c1f · GitHub
[go: up one dir, main page]

Skip to content

Commit 9153c1f

Browse files
committed
feat: enhance GitHub Actions toolset with additional workflow management capabilities
- Added new tools for managing GitHub Actions, including listing workflows, retrieving workflow run logs, and managing workflow runs. - Integrated the new `actions` toolset into the default toolset group for improved accessibility.
1 parent b6d3451 commit 9153c1f

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

pkg/github/actions.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
195195
func RunWorkflow(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
196196
return mcp.NewTool("run_workflow",
197197
mcp.WithDescription(t("TOOL_RUN_WORKFLOW_DESCRIPTION", "Run an Actions workflow")),
198+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
199+
ReadOnlyHint: toBoolPtr(false),
200+
}),
198201
mcp.WithString("owner",
199202
mcp.Required(),
200203
mcp.Description("The account owner of the repository. The name is not case sensitive."),
@@ -549,6 +552,9 @@ func GetJobLogs(getClient GetClientFn, t translations.TranslationHelperFunc) (to
549552
func RerunWorkflowRun(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
550553
return mcp.NewTool("rerun_workflow_run",
551554
mcp.WithDescription(t("TOOL_RERUN_WORKFLOW_RUN_DESCRIPTION", "Re-run an entire workflow run")),
555+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
556+
ReadOnlyHint: toBoolPtr(false),
557+
}),
552558
mcp.WithString("owner",
553559
mcp.Required(),
554560
mcp.Description("The account owner of the repository. The name is not case sensitive."),
@@ -608,6 +614,9 @@ func RerunWorkflowRun(getClient GetClientFn, t translations.TranslationHelperFun
608614
func RerunFailedJobs(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
609615
return mcp.NewTool("rerun_failed_jobs",
610616
mcp.WithDescription(t("TOOL_RERUN_FAILED_JOBS_DESCRIPTION", "Re-run only the failed jobs in a workflow run")),
617+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
618+
ReadOnlyHint: toBoolPtr(false),
619+
}),
611620
mcp.WithString("owner",
612621
mcp.Required(),
613622
mcp.Description("The account owner of the repository. The name is not case sensitive."),
@@ -667,6 +676,9 @@ func RerunFailedJobs(getClient GetClientFn, t translations.TranslationHelperFunc
667676
func CancelWorkflowRun(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
668677
return mcp.NewTool("cancel_workflow_run",
669678
mcp.WithDescription(t("TOOL_CANCEL_WORKFLOW_RUN_DESCRIPTION", "Cancel a workflow run")),
679+
mcp.WithToolAnnotation(mcp.ToolAnnotation{
680+
ReadOnlyHint: toBoolPtr(false),
681+
}),
670682
mcp.WithString("owner",
671683
mcp.Required(),
672684
mcp.Description("The account owner of the repository. The name is not case sensitive."),
@@ -868,6 +880,7 @@ func DeleteWorkflowRunLogs(getClient GetClientFn, t translations.TranslationHelp
868880
return mcp.NewTool("delete_workflow_run_logs",
869881
mcp.WithDescription(t("TOOL_DELETE_WORKFLOW_RUN_LOGS_DESCRIPTION", "Delete logs for a workflow run")),
870882
mcp.WithToolAnnotation(mcp.ToolAnnotation{
883+
ReadOnlyHint: toBoolPtr(false),
871884
DestructiveHint: toBoolPtr(true),
872885
}),
873886
mcp.WithString("owner",

pkg/github/tools.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,26 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
103103
toolsets.NewServerTool(ManageRepositoryNotificationSubscription(getClient, t)),
104104
)
105105

106+
actions := toolsets.NewToolset("actions", "GitHub Actions workflows and CI/CD operations").
107+
AddReadTools(
108+
toolsets.NewServerTool(ListWorkflows(getClient, t)),
109+
toolsets.NewServerTool(ListWorkflowRuns(getClient, t)),
110+
toolsets.NewServerTool(GetWorkflowRun(getClient, t)),
111+
toolsets.NewServerTool(GetWorkflowRunLogs(getClient, t)),
112+
toolsets.NewServerTool(ListWorkflowJobs(getClient, t)),
113+
toolsets.NewServerTool(GetJobLogs(getClient, t)),
114+
toolsets.NewServerTool(ListWorkflowRunArtifacts(getClient, t)),
115+
toolsets.NewServerTool(DownloadWorkflowRunArtifact(getClient, t)),
116+
toolsets.NewServerTool(GetWorkflowRunUsage(getClient, t)),
117+
).
118+
AddWriteTools(
119+
toolsets.NewServerTool(RunWorkflow(getClient, t)),
120+
toolsets.NewServerTool(RerunWorkflowRun(getClient, t)),
121+
toolsets.NewServerTool(RerunFailedJobs(getClient, t)),
122+
toolsets.NewServerTool(CancelWorkflowRun(getClient, t)),
123+
toolsets.NewServerTool(DeleteWorkflowRunLogs(getClient, t)),
124+
)
125+
106126
// Keep experiments alive so the system doesn't error out when it's always enabled
107127
experiments := toolsets.NewToolset("experiments", "Experimental features that are not considered stable yet")
108128

@@ -111,6 +131,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
111131
tsg.AddToolset(issues)
112132
tsg.AddToolset(users)
113133
tsg.AddToolset(pullRequests)
134+
tsg.AddToolset(actions)
114135
tsg.AddToolset(codeSecurity)
115136
tsg.AddToolset(secretProtection)
116137
tsg.AddToolset(notifications)

0 commit comments

Comments
 (0)
0