handleSingleJobLogs gets logs for a single job
(ctx context.Context, client *github.Client, owner, repo string, jobID int64, returnContent bool, tailLines int, contentWindowSize int)
| 113 | |
| 114 | // handleSingleJobLogs gets logs for a single job |
| 115 | func handleSingleJobLogs(ctx context.Context, client *github.Client, owner, repo string, jobID int64, returnContent bool, tailLines int, contentWindowSize int) (*mcp.CallToolResult, any, error) { |
| 116 | jobResult, resp, err := getJobLogData(ctx, client, owner, repo, jobID, "", returnContent, tailLines, contentWindowSize) |
| 117 | if err != nil { |
| 118 | return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get job logs", resp, err), nil, nil |
| 119 | } |
| 120 | |
| 121 | r, err := json.Marshal(jobResult) |
| 122 | if err != nil { |
| 123 | return nil, nil, fmt.Errorf("failed to marshal response: %w", err) |
| 124 | } |
| 125 | |
| 126 | return utils.NewToolResultText(string(r)), nil, nil |
| 127 | } |
| 128 | |
| 129 | // getJobLogData retrieves log data for a single job, either as URL or content |
| 130 | func getJobLogData(ctx context.Context, client *github.Client, owner, repo string, jobID int64, jobName string, returnContent bool, tailLines int, contentWindowSize int) (map[string]any, *github.Response, error) { |
no test coverage detected