MCPcopy
hub / github.com/github/github-mcp-server / getWorkflowRunLogsURL

Function getWorkflowRunLogsURL

pkg/github/actions.go:978–1001  ·  view source on GitHub ↗
(ctx context.Context, client *github.Client, owner, repo string, runID int64)

Source from the content-addressed store, hash-verified

976}
977
978func getWorkflowRunLogsURL(ctx context.Context, client *github.Client, owner, repo string, runID int64) (*mcp.CallToolResult, any, error) {
979 // Get the download URL for the logs
980 url, resp, err := client.Actions.GetWorkflowRunLogs(ctx, owner, repo, runID, 1)
981 if err != nil {
982 return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get workflow run logs", resp, err), nil, nil
983 }
984 defer func() { _ = resp.Body.Close() }()
985
986 // Create response with the logs URL and information
987 result := map[string]any{
988 "logs_url": url.String(),
989 "message": "Workflow run logs are available for download",
990 "note": "The logs_url provides a download link for the complete workflow run logs as a ZIP archive. You can download this archive to extract and examine individual job logs.",
991 "warning": "This downloads ALL logs as a ZIP file which can be large and expensive. For debugging failed jobs, consider using get_job_logs with failed_only=true and run_id instead.",
992 "optimization_tip": "Use: get_job_logs with parameters {run_id: " + fmt.Sprintf("%d", runID) + ", failed_only: true} for more efficient failed job debugging",
993 }
994
995 r, err := json.Marshal(result)
996 if err != nil {
997 return nil, nil, fmt.Errorf("failed to marshal response: %w", err)
998 }
999
1000 return utils.NewToolResultText(string(r)), nil, nil
1001}
1002
1003func getWorkflowRunUsage(ctx context.Context, client *github.Client, owner, repo string, resourceID int64) (*mcp.CallToolResult, any, error) {
1004 usage, resp, err := client.Actions.GetWorkflowRunUsageByID(ctx, owner, repo, resourceID)

Callers 1

ActionsGetFunction · 0.85

Calls 3

NewToolResultTextFunction · 0.92
CloseMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected