Skip to content

Commit d2ba294

Browse files
authored
Add ToolAnnotations to all 8 MCP server tools (#16921)
1 parent 4152d32 commit d2ba294

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

pkg/cli/mcp_server.go

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ func mcpErrorData(v any) json.RawMessage {
3838
return data
3939
}
4040

41+
// boolPtr returns a pointer to the given bool value, used for optional *bool fields.
42+
func boolPtr(b bool) *bool { return &b }
43+
4144
// getRepository retrieves the current repository name (owner/repo format).
4245
// Results are cached for 1 hour to avoid repeated queries.
4346
// Checks GITHUB_REPOSITORY environment variable first, then falls back to gh repo view.
@@ -447,6 +450,11 @@ func createMCPServer(cmdPath string, actor string, validateActor bool) *mcp.Serv
447450

448451
mcp.AddTool(server, &mcp.Tool{
449452
Name: "status",
453+
Annotations: &mcp.ToolAnnotations{
454+
ReadOnlyHint: true,
455+
IdempotentHint: true,
456+
OpenWorldHint: boolPtr(false),
457+
},
450458
Description: `Show status of agentic workflow files and workflows.
451459
452460
Returns a JSON array where each element has the following structure:
@@ -524,6 +532,11 @@ Returns a JSON array where each element has the following structure:
524532

525533
mcp.AddTool(server, &mcp.Tool{
526534
Name: "compile",
535+
Annotations: &mcp.ToolAnnotations{
536+
IdempotentHint: true,
537+
DestructiveHint: boolPtr(false),
538+
OpenWorldHint: boolPtr(false),
539+
},
527540
Description: `Compile Markdown workflows to GitHub Actions YAML with optional static analysis tools.
528541
529542
⚠️ IMPORTANT: Any change to .github/workflows/*.md files MUST be compiled using this tool.
@@ -684,6 +697,11 @@ Returns JSON array with validation results for each workflow:
684697

685698
mcp.AddTool(server, &mcp.Tool{
686699
Name: "logs",
700+
Annotations: &mcp.ToolAnnotations{
701+
ReadOnlyHint: true,
702+
IdempotentHint: true,
703+
OpenWorldHint: boolPtr(true),
704+
},
687705
Description: `Download and analyze workflow logs.
688706
689707
Returns JSON with workflow run data and metrics. If the command times out before fetching all available logs,
@@ -851,6 +869,11 @@ return a schema description instead of the full output. Adjust the 'max_tokens'
851869

852870
mcp.AddTool(server, &mcp.Tool{
853871
Name: "audit",
872+
Annotations: &mcp.ToolAnnotations{
873+
ReadOnlyHint: true,
874+
IdempotentHint: true,
875+
OpenWorldHint: boolPtr(true),
876+
},
854877
Description: `Investigate a workflow run, job, or specific step and generate a concise report.
855878
856879
Accepts multiple input formats:
@@ -957,6 +980,11 @@ Returns JSON with the following structure:
957980

958981
mcp.AddTool(server, &mcp.Tool{
959982
Name: "mcp-inspect",
983+
Annotations: &mcp.ToolAnnotations{
984+
ReadOnlyHint: true,
985+
IdempotentHint: true,
986+
OpenWorldHint: boolPtr(true),
987+
},
960988
Description: `Inspect MCP servers used by a workflow and list available tools, resources, and roots.
961989
962990
This tool starts each MCP server configured in the workflow, queries its capabilities,
@@ -1036,7 +1064,10 @@ Returns formatted text output showing:
10361064
}
10371065

10381066
mcp.AddTool(server, &mcp.Tool{
1039-
Name: "add",
1067+
Name: "add",
1068+
Annotations: &mcp.ToolAnnotations{
1069+
OpenWorldHint: boolPtr(true),
1070+
},
10401071
Description: "Add workflows from remote repositories to .github/workflows",
10411072
Icons: []mcp.Icon{
10421073
{Source: "➕"},
@@ -1104,6 +1135,9 @@ Returns formatted text output showing:
11041135

11051136
mcp.AddTool(server, &mcp.Tool{
11061137
Name: "update",
1138+
Annotations: &mcp.ToolAnnotations{
1139+
OpenWorldHint: boolPtr(true),
1140+
},
11071141
Description: `Update workflows from their source repositories and check for gh-aw updates.
11081142
11091143
The command:
@@ -1177,6 +1211,11 @@ Returns formatted text output showing:
11771211

11781212
mcp.AddTool(server, &mcp.Tool{
11791213
Name: "fix",
1214+
Annotations: &mcp.ToolAnnotations{
1215+
IdempotentHint: true,
1216+
DestructiveHint: boolPtr(false),
1217+
OpenWorldHint: boolPtr(false),
1218+
},
11801219
Description: `Apply automatic codemod-style fixes to agentic workflow files.
11811220
11821221
This command applies a registry of codemods that automatically update deprecated fields

0 commit comments

Comments
 (0)