ActionsGetJobLogs returns the tool and handler for getting workflow job logs.
(t translations.TranslationHelperFunc)
| 645 | |
| 646 | // ActionsGetJobLogs returns the tool and handler for getting workflow job logs. |
| 647 | func ActionsGetJobLogs(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 648 | tool := NewTool( |
| 649 | ToolsetMetadataActions, |
| 650 | mcp.Tool{ |
| 651 | Name: "get_job_logs", |
| 652 | Description: t("TOOL_GET_JOB_LOGS_CONSOLIDATED_DESCRIPTION", `Get logs for GitHub Actions workflow jobs. |
| 653 | Use this tool to retrieve logs for a specific job or all failed jobs in a workflow run. |
| 654 | For single job logs, provide job_id. For all failed jobs in a run, provide run_id with failed_only=true. |
| 655 | `), |
| 656 | Annotations: &mcp.ToolAnnotations{ |
| 657 | Title: t("TOOL_GET_JOB_LOGS_CONSOLIDATED_USER_TITLE", "Get GitHub Actions workflow job logs"), |
| 658 | ReadOnlyHint: true, |
| 659 | }, |
| 660 | InputSchema: &jsonschema.Schema{ |
| 661 | Type: "object", |
| 662 | Properties: map[string]*jsonschema.Schema{ |
| 663 | "owner": { |
| 664 | Type: "string", |
| 665 | Description: "Repository owner", |
| 666 | }, |
| 667 | "repo": { |
| 668 | Type: "string", |
| 669 | Description: "Repository name", |
| 670 | }, |
| 671 | "job_id": { |
| 672 | Type: "number", |
| 673 | Description: "The unique identifier of the workflow job. Required when getting logs for a single job.", |
| 674 | }, |
| 675 | "run_id": { |
| 676 | Type: "number", |
| 677 | Description: "The unique identifier of the workflow run. Required when failed_only is true to get logs for all failed jobs in the run.", |
| 678 | }, |
| 679 | "failed_only": { |
| 680 | Type: "boolean", |
| 681 | Description: "When true, gets logs for all failed jobs in the workflow run specified by run_id. Requires run_id to be provided.", |
| 682 | }, |
| 683 | "return_content": { |
| 684 | Type: "boolean", |
| 685 | Description: "Returns actual log content instead of URLs", |
| 686 | }, |
| 687 | "tail_lines": { |
| 688 | Type: "number", |
| 689 | Description: "Number of lines to return from the end of the log", |
| 690 | Default: json.RawMessage(`500`), |
| 691 | }, |
| 692 | }, |
| 693 | Required: []string{"owner", "repo"}, |
| 694 | }, |
| 695 | }, |
| 696 | []scopes.Scope{scopes.Repo}, |
| 697 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 698 | owner, err := RequiredParam[string](args, "owner") |
| 699 | if err != nil { |
| 700 | return utils.NewToolResultError(err.Error()), nil, nil |
| 701 | } |
| 702 | repo, err := RequiredParam[string](args, "repo") |
| 703 | if err != nil { |
| 704 | return utils.NewToolResultError(err.Error()), nil, nil |