MCPcopy Index your code
hub / github.com/github/github-mcp-server / ListCodeScanningAlerts

Function ListCodeScanningAlerts

pkg/github/code_scanning.go:102–225  ·  view source on GitHub ↗
(t translations.TranslationHelperFunc)

Source from the content-addressed store, hash-verified

100}
101
102func ListCodeScanningAlerts(t translations.TranslationHelperFunc) inventory.ServerTool {
103 schema := &jsonschema.Schema{
104 Type: "object",
105 Properties: map[string]*jsonschema.Schema{
106 "owner": {
107 Type: "string",
108 Description: "The owner of the repository.",
109 },
110 "repo": {
111 Type: "string",
112 Description: "The name of the repository.",
113 },
114 "state": {
115 Type: "string",
116 Description: "Filter code scanning alerts by state. Defaults to open",
117 Enum: []any{"open", "closed", "dismissed", "fixed"},
118 Default: json.RawMessage(`"open"`),
119 },
120 "ref": {
121 Type: "string",
122 Description: "The Git reference for the results you want to list.",
123 },
124 "severity": {
125 Type: "string",
126 Description: "Filter code scanning alerts by severity",
127 Enum: []any{"critical", "high", "medium", "low", "warning", "note", "error"},
128 },
129 "tool_name": {
130 Type: "string",
131 Description: "The name of the tool used for code scanning.",
132 },
133 },
134 Required: []string{"owner", "repo"},
135 }
136 WithPagination(schema)
137
138 return NewTool(
139 ToolsetMetadataCodeSecurity,
140 mcp.Tool{
141 Name: "list_code_scanning_alerts",
142 Description: t("TOOL_LIST_CODE_SCANNING_ALERTS_DESCRIPTION", "List code scanning alerts in a GitHub repository."),
143 Annotations: &mcp.ToolAnnotations{
144 Title: t("TOOL_LIST_CODE_SCANNING_ALERTS_USER_TITLE", "List code scanning alerts"),
145 ReadOnlyHint: true,
146 },
147 InputSchema: schema,
148 },
149 []scopes.Scope{scopes.SecurityEvents},
150 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
151 owner, err := RequiredParam[string](args, "owner")
152 if err != nil {
153 return utils.NewToolResultError(err.Error()), nil, nil
154 }
155 repo, err := RequiredParam[string](args, "repo")
156 if err != nil {
157 return utils.NewToolResultError(err.Error()), nil, nil
158 }
159 ref, err := OptionalParam[string](args, "ref")

Callers 2

AllToolsFunction · 0.85

Calls 11

NewToolResultErrorFunction · 0.92
NewToolResultTextFunction · 0.92
LabelSecurityAlertFunction · 0.92
WithPaginationFunction · 0.85
NewToolFunction · 0.85
OptionalPaginationParamsFunction · 0.85
attachStaticIFCLabelFunction · 0.85
CloseMethod · 0.80
GetClientMethod · 0.65
ErrorMethod · 0.45

Tested by 1