ActionsGet returns the tool and handler for getting GitHub Actions resources.
(t translations.TranslationHelperFunc)
| 406 | |
| 407 | // ActionsGet returns the tool and handler for getting GitHub Actions resources. |
| 408 | func ActionsGet(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 409 | tool := NewTool( |
| 410 | ToolsetMetadataActions, |
| 411 | mcp.Tool{ |
| 412 | Name: "actions_get", |
| 413 | Description: t("TOOL_ACTIONS_GET_DESCRIPTION", `Get details about specific GitHub Actions resources. |
| 414 | Use this tool to get details about individual workflows, workflow runs, jobs, and artifacts by their unique IDs. |
| 415 | `), |
| 416 | Annotations: &mcp.ToolAnnotations{ |
| 417 | Title: t("TOOL_ACTIONS_GET_USER_TITLE", "Get details of GitHub Actions resources (workflows, workflow runs, jobs, and artifacts)"), |
| 418 | ReadOnlyHint: true, |
| 419 | }, |
| 420 | InputSchema: &jsonschema.Schema{ |
| 421 | Type: "object", |
| 422 | Properties: map[string]*jsonschema.Schema{ |
| 423 | "method": { |
| 424 | Type: "string", |
| 425 | Description: "The method to execute", |
| 426 | Enum: []any{ |
| 427 | actionsMethodGetWorkflow, |
| 428 | actionsMethodGetWorkflowRun, |
| 429 | actionsMethodGetWorkflowJob, |
| 430 | actionsMethodDownloadWorkflowArtifact, |
| 431 | actionsMethodGetWorkflowRunUsage, |
| 432 | actionsMethodGetWorkflowRunLogsURL, |
| 433 | }, |
| 434 | }, |
| 435 | "owner": { |
| 436 | Type: "string", |
| 437 | Description: "Repository owner", |
| 438 | }, |
| 439 | "repo": { |
| 440 | Type: "string", |
| 441 | Description: "Repository name", |
| 442 | }, |
| 443 | "resource_id": { |
| 444 | Type: "string", |
| 445 | Description: `The unique identifier of the resource. This will vary based on the "method" provided, so ensure you provide the correct ID: |
| 446 | - Provide a workflow ID or workflow file name (e.g. ci.yaml) for 'get_workflow' method. |
| 447 | - Provide a workflow run ID for 'get_workflow_run', 'get_workflow_run_usage', and 'get_workflow_run_logs_url' methods. |
| 448 | - Provide an artifact ID for 'download_workflow_run_artifact' method. |
| 449 | - Provide a job ID for 'get_workflow_job' method. |
| 450 | `, |
| 451 | }, |
| 452 | }, |
| 453 | Required: []string{"method", "owner", "repo", "resource_id"}, |
| 454 | }, |
| 455 | }, |
| 456 | []scopes.Scope{scopes.Repo}, |
| 457 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 458 | owner, err := RequiredParam[string](args, "owner") |
| 459 | if err != nil { |
| 460 | return utils.NewToolResultError(err.Error()), nil, nil |
| 461 | } |
| 462 | repo, err := RequiredParam[string](args, "repo") |
| 463 | if err != nil { |
| 464 | return utils.NewToolResultError(err.Error()), nil, nil |
| 465 | } |