Skip to content

Commit 6c1d24a

Browse files
committed
create toolsnaps
1 parent 9787684 commit 6c1d24a

9 files changed

+289
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"annotations": {
3+
"title": "Cancel workflow run"
4+
},
5+
"description": "Cancel a workflow run",
6+
"inputSchema": {
7+
"type": "object",
8+
"required": [
9+
"owner",
10+
"repo",
11+
"run_id"
12+
],
13+
"properties": {
14+
"owner": {
15+
"type": "string",
16+
"description": "Repository owner"
17+
},
18+
"repo": {
19+
"type": "string",
20+
"description": "Repository name"
21+
},
22+
"run_id": {
23+
"type": "number",
24+
"description": "The unique identifier of the workflow run"
25+
}
26+
}
27+
},
28+
"name": "cancel_workflow_run"
29+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"annotations": {
3+
"destructiveHint": true,
4+
"title": "Delete workflow logs"
5+
},
6+
"description": "Delete logs for a workflow run",
7+
"inputSchema": {
8+
"type": "object",
9+
"required": [
10+
"owner",
11+
"repo",
12+
"run_id"
13+
],
14+
"properties": {
15+
"owner": {
16+
"type": "string",
17+
"description": "Repository owner"
18+
},
19+
"repo": {
20+
"type": "string",
21+
"description": "Repository name"
22+
},
23+
"run_id": {
24+
"type": "number",
25+
"description": "The unique identifier of the workflow run"
26+
}
27+
}
28+
},
29+
"name": "delete_workflow_run_logs"
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"annotations": {
3+
"readOnlyHint": true,
4+
"title": "Download workflow artifact"
5+
},
6+
"description": "Get download URL for a workflow run artifact",
7+
"inputSchema": {
8+
"type": "object",
9+
"required": [
10+
"owner",
11+
"repo",
12+
"artifact_id"
13+
],
14+
"properties": {
15+
"artifact_id": {
16+
"type": "number",
17+
"description": "The unique identifier of the artifact"
18+
},
19+
"owner": {
20+
"type": "string",
21+
"description": "Repository owner"
22+
},
23+
"repo": {
24+
"type": "string",
25+
"description": "Repository name"
26+
}
27+
}
28+
},
29+
"name": "download_workflow_run_artifact"
30+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"annotations": {
3+
"readOnlyHint": true,
4+
"title": "Get job logs"
5+
},
6+
"description": "Download logs for a specific workflow job or efficiently get all failed job logs for a workflow run",
7+
"inputSchema": {
8+
"type": "object",
9+
"required": [
10+
"owner",
11+
"repo"
12+
],
13+
"properties": {
14+
"failed_only": {
15+
"type": "boolean",
16+
"description": "When true, gets logs for all failed jobs in run_id"
17+
},
18+
"job_id": {
19+
"type": "number",
20+
"description": "The unique identifier of the workflow job (required for single job logs)"
21+
},
22+
"owner": {
23+
"type": "string",
24+
"description": "Repository owner"
25+
},
26+
"repo": {
27+
"type": "string",
28+
"description": "Repository name"
29+
},
30+
"return_content": {
31+
"type": "boolean",
32+
"description": "Returns actual log content instead of URLs"
33+
},
34+
"run_id": {
35+
"type": "number",
36+
"description": "Workflow run ID (required when using failed_only)"
37+
},
38+
"tail_lines": {
39+
"type": "number",
40+
"description": "Number of lines to return from the end of the log",
41+
"default": 500
42+
}
43+
}
44+
},
45+
"name": "get_job_logs"
46+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"annotations": {
3+
"readOnlyHint": true,
4+
"title": "Get workflow usage"
5+
},
6+
"description": "Get usage metrics for a workflow run",
7+
"inputSchema": {
8+
"type": "object",
9+
"required": [
10+
"owner",
11+
"repo",
12+
"run_id"
13+
],
14+
"properties": {
15+
"owner": {
16+
"type": "string",
17+
"description": "Repository owner"
18+
},
19+
"repo": {
20+
"type": "string",
21+
"description": "Repository name"
22+
},
23+
"run_id": {
24+
"type": "number",
25+
"description": "The unique identifier of the workflow run"
26+
}
27+
}
28+
},
29+
"name": "get_workflow_run_usage"
30+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"annotations": {
3+
"readOnlyHint": true,
4+
"title": "List workflow artifacts"
5+
},
6+
"description": "List artifacts for a workflow run",
7+
"inputSchema": {
8+
"type": "object",
9+
"required": [
10+
"owner",
11+
"repo",
12+
"run_id"
13+
],
14+
"properties": {
15+
"owner": {
16+
"type": "string",
17+
"description": "Repository owner"
18+
},
19+
"page": {
20+
"type": "number",
21+
"description": "Page number for pagination (min 1)",
22+
"minimum": 1
23+
},
24+
"perPage": {
25+
"type": "number",
26+
"description": "Results per page for pagination (min 1, max 100)",
27+
"minimum": 1,
28+
"maximum": 100
29+
},
30+
"repo": {
31+
"type": "string",
32+
"description": "Repository name"
33+
},
34+
"run_id": {
35+
"type": "number",
36+
"description": "The unique identifier of the workflow run"
37+
}
38+
}
39+
},
40+
"name": "list_workflow_run_artifacts"
41+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"annotations": {
3+
"readOnlyHint": true,
4+
"title": "List workflows"
5+
},
6+
"description": "List workflows in a repository",
7+
"inputSchema": {
8+
"type": "object",
9+
"required": [
10+
"owner",
11+
"repo"
12+
],
13+
"properties": {
14+
"owner": {
15+
"type": "string",
16+
"description": "Repository owner"
17+
},
18+
"page": {
19+
"type": "number",
20+
"description": "Page number for pagination (min 1)",
21+
"minimum": 1
22+
},
23+
"perPage": {
24+
"type": "number",
25+
"description": "Results per page for pagination (min 1, max 100)",
26+
"minimum": 1,
27+
"maximum": 100
28+
},
29+
"repo": {
30+
"type": "string",
31+
"description": "Repository name"
32+
}
33+
}
34+
},
35+
"name": "list_workflows"
36+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"annotations": {
3+
"title": "Run workflow"
4+
},
5+
"description": "Run an Actions workflow by workflow ID or filename",
6+
"inputSchema": {
7+
"type": "object",
8+
"required": [
9+
"owner",
10+
"repo",
11+
"workflow_id",
12+
"ref"
13+
],
14+
"properties": {
15+
"inputs": {
16+
"type": "object",
17+
"description": "Inputs the workflow accepts"
18+
},
19+
"owner": {
20+
"type": "string",
21+
"description": "Repository owner"
22+
},
23+
"ref": {
24+
"type": "string",
25+
"description": "The git reference for the workflow. The reference can be a branch or tag name."
26+
},
27+
"repo": {
28+
"type": "string",
29+
"description": "Repository name"
30+
},
31+
"workflow_id": {
32+
"type": "string",
33+
"description": "The workflow ID (numeric) or workflow file name (e.g., main.yml, ci.yaml)"
34+
}
35+
}
36+
},
37+
"name": "run_workflow"
38+
}

pkg/github/actions_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"testing"
1414

1515
"github.com/github/github-mcp-server/internal/profiler"
16+
"github.com/github/github-mcp-server/internal/toolsnaps"
1617
buffer "github.com/github/github-mcp-server/pkg/buffer"
1718
"github.com/github/github-mcp-server/pkg/translations"
1819
"github.com/google/go-github/v79/github"
@@ -26,6 +27,7 @@ func Test_ListWorkflows(t *testing.T) {
2627
// Verify tool definition once
2728
mockClient := github.NewClient(nil)
2829
tool, _ := ListWorkflows(stubGetClientFn(mockClient), translations.NullTranslationHelper)
30+
require.NoError(t, toolsnaps.Test(tool.Name, tool))
2931

3032
assert.Equal(t, "list_workflows", tool.Name)
3133
assert.NotEmpty(t, tool.Description)
@@ -138,6 +140,7 @@ func Test_RunWorkflow(t *testing.T) {
138140
// Verify tool definition once
139141
mockClient := github.NewClient(nil)
140142
tool, _ := RunWorkflow(stubGetClientFn(mockClient), translations.NullTranslationHelper)
143+
require.NoError(t, toolsnaps.Test(tool.Name, tool))
141144

142145
assert.Equal(t, "run_workflow", tool.Name)
143146
assert.NotEmpty(t, tool.Description)
@@ -314,6 +317,7 @@ func Test_CancelWorkflowRun(t *testing.T) {
314317
// Verify tool definition once
315318
mockClient := github.NewClient(nil)
316319
tool, _ := CancelWorkflowRun(stubGetClientFn(mockClient), translations.NullTranslationHelper)
320+
require.NoError(t, toolsnaps.Test(tool.Name, tool))
317321

318322
assert.Equal(t, "cancel_workflow_run", tool.Name)
319323
assert.NotEmpty(t, tool.Description)
@@ -419,6 +423,7 @@ func Test_ListWorkflowRunArtifacts(t *testing.T) {
419423
// Verify tool definition once
420424
mockClient := github.NewClient(nil)
421425
tool, _ := ListWorkflowRunArtifacts(stubGetClientFn(mockClient), translations.NullTranslationHelper)
426+
require.NoError(t, toolsnaps.Test(tool.Name, tool))
422427

423428
assert.Equal(t, "list_workflow_run_artifacts", tool.Name)
424429
assert.NotEmpty(t, tool.Description)
@@ -547,6 +552,7 @@ func Test_DownloadWorkflowRunArtifact(t *testing.T) {
547552
// Verify tool definition once
548553
mockClient := github.NewClient(nil)
549554
tool, _ := DownloadWorkflowRunArtifact(stubGetClientFn(mockClient), translations.NullTranslationHelper)
555+
require.NoError(t, toolsnaps.Test(tool.Name, tool))
550556

551557
assert.Equal(t, "download_workflow_run_artifact", tool.Name)
552558
assert.NotEmpty(t, tool.Description)
@@ -635,6 +641,7 @@ func Test_DeleteWorkflowRunLogs(t *testing.T) {
635641
// Verify tool definition once
636642
mockClient := github.NewClient(nil)
637643
tool, _ := DeleteWorkflowRunLogs(stubGetClientFn(mockClient), translations.NullTranslationHelper)
644+
require.NoError(t, toolsnaps.Test(tool.Name, tool))
638645

639646
assert.Equal(t, "delete_workflow_run_logs", tool.Name)
640647
assert.NotEmpty(t, tool.Description)
@@ -716,6 +723,7 @@ func Test_GetWorkflowRunUsage(t *testing.T) {
716723
// Verify tool definition once
717724
mockClient := github.NewClient(nil)
718725
tool, _ := GetWorkflowRunUsage(stubGetClientFn(mockClient), translations.NullTranslationHelper)
726+
require.NoError(t, toolsnaps.Test(tool.Name, tool))
719727

720728
assert.Equal(t, "get_workflow_run_usage", tool.Name)
721729
assert.NotEmpty(t, tool.Description)
@@ -817,6 +825,7 @@ func Test_GetJobLogs(t *testing.T) {
817825
// Verify tool definition once
818826
mockClient := github.NewClient(nil)
819827
tool, _ := GetJobLogs(stubGetClientFn(mockClient), translations.NullTranslationHelper, 5000)
828+
require.NoError(t, toolsnaps.Test(tool.Name, tool))
820829

821830
assert.Equal(t, "get_job_logs", tool.Name)
822831
assert.NotEmpty(t, tool.Description)

0 commit comments

Comments
 (0)