Skip to content

Commit a29225d

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 219c3bb commit a29225d

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
@@ -111,6 +111,26 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
111111
toolsets.NewServerTool(ManageRepositoryNotificationSubscription(getClient, t)),
112112
)
113113

114+
actions := toolsets.NewToolset("actions", "GitHub Actions workflows and CI/CD operations").
115+
AddReadTools(
116+
toolsets.NewServerTool(ListWorkflows(getClient, t)),
117+
toolsets.NewServerTool(ListWorkflowRuns(getClient, t)),
118+
toolsets.NewServerTool(GetWorkflowRun(getClient, t)),
119+
toolsets.NewServerTool(GetWorkflowRunLogs(getClient, t)),
120+
toolsets.NewServerTool(ListWorkflowJobs(getClient, t)),
121+
toolsets.NewServerTool(GetJobLogs(getClient, t)),
122+
toolsets.NewServerTool(ListWorkflowRunArtifacts(getClient, t)),
123+
toolsets.NewServerTool(DownloadWorkflowRunArtifact(getClient, t)),
124+
toolsets.NewServerTool(GetWorkflowRunUsage(getClient, t)),
125+
).
126+
AddWriteTools(
127+
toolsets.NewServerTool(RunWorkflow(getClient, t)),
128+
toolsets.NewServerTool(RerunWorkflowRun(getClient, t)),
129+
toolsets.NewServerTool(RerunFailedJobs(getClient, t)),
130+
toolsets.NewServerTool(CancelWorkflowRun(getClient, t)),
131+
toolsets.NewServerTool(DeleteWorkflowRunLogs(getClient, t)),
132+
)
133+
114134
// Keep experiments alive so the system doesn't error out when it's always enabled
115135
experiments := toolsets.NewToolset("experiments", "Experimental features that are not considered stable yet")
116136

@@ -125,6 +145,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
125145
tsg.AddToolset(issues)
126146
tsg.AddToolset(users)
127147
tsg.AddToolset(pullRequests)
148+
tsg.AddToolset(actions)
128149
tsg.AddToolset(codeSecurity)
129150
tsg.AddToolset(secretProtection)
130151
tsg.AddToolset(notifications)

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