ActionsRunTrigger returns the tool and handler for triggering GitHub Actions workflows.
(t translations.TranslationHelperFunc)
| 528 | |
| 529 | // ActionsRunTrigger returns the tool and handler for triggering GitHub Actions workflows. |
| 530 | func ActionsRunTrigger(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 531 | tool := NewTool( |
| 532 | ToolsetMetadataActions, |
| 533 | mcp.Tool{ |
| 534 | Name: "actions_run_trigger", |
| 535 | Description: t("TOOL_ACTIONS_RUN_TRIGGER_DESCRIPTION", "Trigger GitHub Actions workflow operations, including running, re-running, cancelling workflow runs, and deleting workflow run logs."), |
| 536 | Annotations: &mcp.ToolAnnotations{ |
| 537 | Title: t("TOOL_ACTIONS_RUN_TRIGGER_USER_TITLE", "Trigger GitHub Actions workflow actions"), |
| 538 | ReadOnlyHint: false, |
| 539 | DestructiveHint: jsonschema.Ptr(true), |
| 540 | }, |
| 541 | InputSchema: &jsonschema.Schema{ |
| 542 | Type: "object", |
| 543 | Properties: map[string]*jsonschema.Schema{ |
| 544 | "method": { |
| 545 | Type: "string", |
| 546 | Description: "The method to execute", |
| 547 | Enum: []any{ |
| 548 | actionsMethodRunWorkflow, |
| 549 | actionsMethodRerunWorkflowRun, |
| 550 | actionsMethodRerunFailedJobs, |
| 551 | actionsMethodCancelWorkflowRun, |
| 552 | actionsMethodDeleteWorkflowRunLogs, |
| 553 | }, |
| 554 | }, |
| 555 | "owner": { |
| 556 | Type: "string", |
| 557 | Description: "Repository owner", |
| 558 | }, |
| 559 | "repo": { |
| 560 | Type: "string", |
| 561 | Description: "Repository name", |
| 562 | }, |
| 563 | "workflow_id": { |
| 564 | Type: "string", |
| 565 | Description: "The workflow ID (numeric) or workflow file name (e.g., main.yml, ci.yaml). Required for 'run_workflow' method.", |
| 566 | }, |
| 567 | "ref": { |
| 568 | Type: "string", |
| 569 | Description: "The git reference for the workflow. The reference can be a branch or tag name. Required for 'run_workflow' method.", |
| 570 | }, |
| 571 | "inputs": { |
| 572 | Type: "object", |
| 573 | Description: "Inputs the workflow accepts. Only used for 'run_workflow' method.", |
| 574 | Properties: map[string]*jsonschema.Schema{}, |
| 575 | }, |
| 576 | "run_id": { |
| 577 | Type: "number", |
| 578 | Description: "The ID of the workflow run. Required for all methods except 'run_workflow'.", |
| 579 | }, |
| 580 | }, |
| 581 | Required: []string{"method", "owner", "repo"}, |
| 582 | }, |
| 583 | }, |
| 584 | []scopes.Scope{scopes.Repo}, |
| 585 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 586 | owner, err := RequiredParam[string](args, "owner") |
| 587 | if err != nil { |