Skip to content

Commit b05b370

Browse files
authored
fix: include default values in jsonschema (#399)
1 parent 5b28181 commit b05b370

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

tools/alerting.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const (
2222
)
2323

2424
type ListAlertRulesParams struct {
25-
Limit int `json:"limit,omitempty" jsonschema:"description=The maximum number of results to return. Default is 100."`
26-
Page int `json:"page,omitempty" jsonschema:"description=The page number to return."`
25+
Limit int `json:"limit,omitempty" jsonschema:"default=100,description=The maximum number of results to return"`
26+
Page int `json:"page,omitempty" jsonschema:"default=1,description=The page number to return"`
2727
LabelSelectors []Selector `json:"label_selectors,omitempty" jsonschema:"description=Optionally\\, a list of matchers to filter alert rules by labels"`
2828
}
2929

@@ -307,7 +307,7 @@ var GetAlertRuleByUID = mcpgrafana.MustTool(
307307
)
308308

309309
type ListContactPointsParams struct {
310-
Limit int `json:"limit,omitempty" jsonschema:"description=The maximum number of results to return. Default is 100."`
310+
Limit int `json:"limit,omitempty" jsonschema:"default=100,description=The maximum number of results to return"`
311311
Name *string `json:"name,omitempty" jsonschema:"description=Filter contact points by name"`
312312
}
313313

tools/incident.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
type ListIncidentsParams struct {
14-
Limit int `json:"limit" jsonschema:"description=The maximum number of incidents to return"`
14+
Limit int `json:"limit" jsonschema:"default=10,description=The maximum number of incidents to return"`
1515
Drill bool `json:"drill" jsonschema:"description=Whether to include drill incidents"`
1616
Status string `json:"status" jsonschema:"description=The status of the incidents to include. Valid values: 'active'\\, 'resolved'"`
1717
}

tools/loki.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ type QueryLokiLogsParams struct {
384384
LogQL string `json:"logql" jsonschema:"required,description=The LogQL query to execute against Loki. This can be a simple label matcher or a complex query with filters\\, parsers\\, and expressions. Supports full LogQL syntax including label matchers\\, filter operators\\, pattern expressions\\, and pipeline operations."`
385385
StartRFC3339 string `json:"startRfc3339,omitempty" jsonschema:"description=Optionally\\, the start time of the query in RFC3339 format"`
386386
EndRFC3339 string `json:"endRfc3339,omitempty" jsonschema:"description=Optionally\\, the end time of the query in RFC3339 format"`
387-
Limit int `json:"limit,omitempty" jsonschema:"description=Optionally\\, the maximum number of log lines to return (default: 10\\, max: 100)"`
387+
Limit int `json:"limit,omitempty" jsonschema:"default=10,description=Optionally\\, the maximum number of log lines to return (max: 100)"`
388388
Direction string `json:"direction,omitempty" jsonschema:"description=Optionally\\, the direction of the query: 'forward' (oldest first) or 'backward' (newest first\\, default)"`
389389
}
390390

tools/prometheus.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func promClientFromContext(ctx context.Context, uid string) (promv1.API, error)
8585

8686
type ListPrometheusMetricMetadataParams struct {
8787
DatasourceUID string `json:"datasourceUid" jsonschema:"required,description=The UID of the datasource to query"`
88-
Limit int `json:"limit" jsonschema:"description=The maximum number of metrics to return"`
88+
Limit int `json:"limit" jsonschema:"default=10,description=The maximum number of metrics to return"`
8989
LimitPerMetric int `json:"limitPerMetric" jsonschema:"description=The maximum number of metrics to return per metric"`
9090
Metric string `json:"metric" jsonschema:"description=The metric to query"`
9191
}
@@ -196,8 +196,8 @@ var QueryPrometheus = mcpgrafana.MustTool(
196196
type ListPrometheusMetricNamesParams struct {
197197
DatasourceUID string `json:"datasourceUid" jsonschema:"required,description=The UID of the datasource to query"`
198198
Regex string `json:"regex" jsonschema:"description=The regex to match against the metric names"`
199-
Limit int `json:"limit,omitempty" jsonschema:"description=The maximum number of results to return"`
200-
Page int `json:"page,omitempty" jsonschema:"description=The page number to return"`
199+
Limit int `json:"limit,omitempty" jsonschema:"default=10,description=The maximum number of results to return"`
200+
Page int `json:"page,omitempty" jsonschema:"default=1,description=The page number to return"`
201201
}
202202

203203
func listPrometheusMetricNames(ctx context.Context, args ListPrometheusMetricNamesParams) ([]string, error) {
@@ -315,7 +315,7 @@ type ListPrometheusLabelNamesParams struct {
315315
Matches []Selector `json:"matches,omitempty" jsonschema:"description=Optionally\\, a list of label matchers to filter the results by"`
316316
StartRFC3339 string `json:"startRfc3339,omitempty" jsonschema:"description=Optionally\\, the start time of the time range to filter the results by"`
317317
EndRFC3339 string `json:"endRfc3339,omitempty" jsonschema:"description=Optionally\\, the end time of the time range to filter the results by"`
318-
Limit int `json:"limit,omitempty" jsonschema:"description=Optionally\\, the maximum number of results to return"`
318+
Limit int `json:"limit,omitempty" jsonschema:"default=100,description=Optionally\\, the maximum number of results to return"`
319319
}
320320

321321
func listPrometheusLabelNames(ctx context.Context, args ListPrometheusLabelNamesParams) ([]string, error) {
@@ -374,7 +374,7 @@ type ListPrometheusLabelValuesParams struct {
374374
Matches []Selector `json:"matches,omitempty" jsonschema:"description=Optionally\\, a list of selectors to filter the results by"`
375375
StartRFC3339 string `json:"startRfc3339,omitempty" jsonschema:"description=Optionally\\, the start time of the query"`
376376
EndRFC3339 string `json:"endRfc3339,omitempty" jsonschema:"description=Optionally\\, the end time of the query"`
377-
Limit int `json:"limit,omitempty" jsonschema:"description=Optionally\\, the maximum number of results to return"`
377+
Limit int `json:"limit,omitempty" jsonschema:"default=100,description=Optionally\\, the maximum number of results to return"`
378378
}
379379

380380
func listPrometheusLabelValues(ctx context.Context, args ListPrometheusLabelValuesParams) (model.LabelValues, error) {

tools/sift.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ var GetSiftAnalysis = mcpgrafana.MustTool(
231231

232232
// ListSiftInvestigationsParams defines the parameters for retrieving investigations
233233
type ListSiftInvestigationsParams struct {
234-
Limit int `json:"limit,omitempty" jsonschema:"description=Maximum number of investigations to return. Defaults to 10 if not specified."`
234+
Limit int `json:"limit,omitempty" jsonschema:"default=10,description=Maximum number of investigations to return"`
235235
}
236236

237237
// listSiftInvestigations retrieves a list of investigations with an optional limit

0 commit comments

Comments
 (0)