Skip to content

Commit 72b5e46

Browse files
committed
Improve descriptions of structs and tools
1 parent 1973f8c commit 72b5e46

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tools/loki.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ func (rt *authRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
176176
// ListLokiLabelNamesParams defines the parameters for listing Loki label names
177177
type ListLokiLabelNamesParams struct {
178178
DatasourceUID string `json:"datasourceUid" jsonschema:"required,description=The UID of the datasource to query"`
179-
StartRFC3339 string `json:"startRfc3339,omitempty" jsonschema:"description=Optionally, the start time of the time range to filter the results by"`
180-
EndRFC3339 string `json:"endRfc3339,omitempty" jsonschema:"description=Optionally, the end time of the time range to filter the results by"`
179+
StartRFC3339 string `json:"startRfc3339,omitempty" jsonschema:"description=Optionally, the start time of the query in RFC3339 format (defaults to 1 hour ago)"`
180+
EndRFC3339 string `json:"endRfc3339,omitempty" jsonschema:"description=Optionally, the end time of the query in RFC3339 format (defaults to now)"`
181181
}
182182

183183
// listLokiLabelNames lists all label names in a Loki datasource
@@ -202,16 +202,16 @@ func listLokiLabelNames(ctx context.Context, args ListLokiLabelNamesParams) ([]s
202202
// ListLokiLabelNames is a tool for listing Loki label names
203203
var ListLokiLabelNames = mcpgrafana.MustTool(
204204
"list_loki_label_names",
205-
"List the label names in a Loki datasource",
205+
"List all available label names in a Loki datasource for the given time range. Returns the set of unique label keys found in the logs.",
206206
listLokiLabelNames,
207207
)
208208

209209
// ListLokiLabelValuesParams defines the parameters for listing Loki label values
210210
type ListLokiLabelValuesParams struct {
211211
DatasourceUID string `json:"datasourceUid" jsonschema:"required,description=The UID of the datasource to query"`
212-
LabelName string `json:"labelName" jsonschema:"required,description=The name of the label to query"`
213-
StartRFC3339 string `json:"startRfc3339,omitempty" jsonschema:"description=Optionally, the start time of the query"`
214-
EndRFC3339 string `json:"endRfc3339,omitempty" jsonschema:"description=Optionally, the end time of the query"`
212+
LabelName string `json:"labelName" jsonschema:"required,description=The name of the label to retrieve values for (e.g. 'app', 'env', 'pod')"`
213+
StartRFC3339 string `json:"startRfc3339,omitempty" jsonschema:"description=Optionally, the start time of the query in RFC3339 format (defaults to 1 hour ago)"`
214+
EndRFC3339 string `json:"endRfc3339,omitempty" jsonschema:"description=Optionally, the end time of the query in RFC3339 format (defaults to now)"`
215215
}
216216

217217
// listLokiLabelValues lists all values for a specific label in a Loki datasource
@@ -240,7 +240,7 @@ func listLokiLabelValues(ctx context.Context, args ListLokiLabelValuesParams) ([
240240
// ListLokiLabelValues is a tool for listing Loki label values
241241
var ListLokiLabelValues = mcpgrafana.MustTool(
242242
"list_loki_label_values",
243-
"Get the values of a label in Loki",
243+
"Retrieve all possible values for a specific label in Loki within the given time range. Useful for exploring available options for filtering logs.",
244244
listLokiLabelValues,
245245
)
246246

@@ -334,11 +334,11 @@ func (c *Client) fetchLogs(ctx context.Context, query, startRFC3339, endRFC3339
334334
// QueryLokiLogsParams defines the parameters for querying Loki logs
335335
type QueryLokiLogsParams struct {
336336
DatasourceUID string `json:"datasourceUid" jsonschema:"required,description=The UID of the datasource to query"`
337-
LogQL string `json:"logql" jsonschema:"required,description=The LogQL query to execute"`
337+
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."`
338338
StartRFC3339 string `json:"startRfc3339,omitempty" jsonschema:"description=Optionally, the start time of the query in RFC3339 format"`
339339
EndRFC3339 string `json:"endRfc3339,omitempty" jsonschema:"description=Optionally, the end time of the query in RFC3339 format"`
340340
Limit int `json:"limit,omitempty" jsonschema:"description=Optionally, the maximum number of log lines to return (default: 10, max: 100)"`
341-
Direction string `json:"direction,omitempty" jsonschema:"description=Optionally, the direction of the query: 'forward' or 'backward'"`
341+
Direction string `json:"direction,omitempty" jsonschema:"description=Optionally, the direction of the query: 'forward' (oldest first) or 'backward' (newest first, default)"`
342342
}
343343

344344
// LogEntry represents a single log entry with metadata
@@ -414,7 +414,7 @@ func queryLokiLogs(ctx context.Context, args QueryLokiLogsParams) ([]LogEntry, e
414414
// QueryLokiLogs is a tool for querying logs from Loki
415415
var QueryLokiLogs = mcpgrafana.MustTool(
416416
"query_loki_logs",
417-
"Query logs from a Loki datasource using LogQL",
417+
"Query and retrieve log entries from a Loki datasource using LogQL. Returns log lines with timestamps and labels. Use query_loki_stats first to check stream size, then list_loki_label_names/values to verify labels exist. Supports full LogQL syntax including filters and expressions.",
418418
queryLokiLogs,
419419
)
420420

@@ -445,7 +445,7 @@ func (c *Client) fetchStats(ctx context.Context, query, startRFC3339, endRFC3339
445445
// QueryLokiStatsParams defines the parameters for querying Loki stats
446446
type QueryLokiStatsParams struct {
447447
DatasourceUID string `json:"datasourceUid" jsonschema:"required,description=The UID of the datasource to query"`
448-
LogQL string `json:"logql" jsonschema:"required,description=The LogQL query to execute"`
448+
LogQL string `json:"logql" jsonschema:"required,description=The LogQL matcher expression to execute. This parameter only accepts label matcher expressions and does not support full LogQL queries. Line filters, pattern operations, and metric aggregations are not supported by the stats API endpoint. Only simple label selectors can be used here."`
449449
StartRFC3339 string `json:"startRfc3339,omitempty" jsonschema:"description=Optionally, the start time of the query in RFC3339 format"`
450450
EndRFC3339 string `json:"endRfc3339,omitempty" jsonschema:"description=Optionally, the end time of the query in RFC3339 format"`
451451
}

0 commit comments

Comments
 (0)