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