From 84bf4657793faa2ad1e6687623a8e30129984d56 Mon Sep 17 00:00:00 2001 From: Ece Kayan <153294887+ecekyn@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:20:10 +0000 Subject: [PATCH] Improve tool descriptions for LLM (#21) * Descriptions for how to use get logs, traces, metric done * Improve the descriptions for tools * Argument descriptions for log and K8s event endpoints are done * Add descriptions for node and metric arguments * Argument descriptions for trace and k8s endpoints --- main.go | 101 +++++++++++++++--------- model/model.go | 8 +- tools/get_alert_fires.go | 4 +- tools/get_k8s_event_attribute_values.go | 13 ++- tools/get_k8s_events.go | 14 ++-- tools/get_k8s_events_volume.go | 10 +-- tools/get_k8s_service_information.go | 6 +- tools/get_log_attribute_values.go | 14 ++-- tools/get_logs.go | 12 ++- tools/get_metric.go | 18 ++--- tools/get_metric_attributes.go | 6 +- tools/get_metric_names.go | 2 +- tools/get_node_attributes.go | 30 +++++++ tools/get_node_info.go | 2 +- tools/get_nodes.go | 11 ++- tools/get_pods.go | 2 +- tools/get_profiles.go | 2 +- tools/get_service_summaries.go | 6 +- tools/get_trace_attribute_values.go | 16 ++-- tools/get_trace_metric.go | 12 +-- tools/get_traces.go | 10 +-- 21 files changed, 171 insertions(+), 128 deletions(-) create mode 100644 tools/get_node_attributes.go diff --git a/main.go b/main.go index 190949a..9d385e5 100644 --- a/main.go +++ b/main.go @@ -19,132 +19,157 @@ type MetoroTools struct { var metoroTools = []MetoroTools{ { Name: "get_environments", - Description: "Get Kubernetes environments/clusters, monitored by Metoro", + Description: "Get Kubernetes environments/clusters", Handler: tools.GetEnvironmentsHandler, }, { Name: "get_services", - Description: "Get services running in your Kubernetes cluster, monitored by Metoro", + Description: "Get services running in your Kubernetes cluster. Metoro treats the following Kubernetes resources as a 'service': Deployment, StatefulSet, DaemonSet", Handler: tools.GetServicesHandler, }, { Name: "get_namespaces", - Description: "Get namespaces in your Kubernetes cluster, monitored by Metoro", + Description: "Get namespaces in your Kubernetes cluster", Handler: tools.GetNamespacesHandler, }, { - Name: "get_logs", - Description: "Get logs from all/any services/hosts/pods running in your Kubernetes cluster. Results are limited to 100 logs lines", - Handler: tools.GetLogsHandler, + Name: "get_logs", + Description: `Get logs from all or specific services/hosts/pods running in your Kubernetes cluster. Results are limited to 100 logs lines. How to use this tool: + First, use get_log_attributes tool to retrieve the available log attribute keys which can be used as Filter or ExcludeFilter keys for this tool. + Then use get_log_attribute_values_for_individual_attribute tool to get the possible values a log attribute key can be used for filtering logs. + Then you can use this tool (get_logs) to get the specific logs you are looking for. + e.g. Filter use case: get_logs with filters: {key: [value]} for including specific logs. Where the key was retrieved from get_log_attributes tool and the value was retrieved from get_log_attribute_values_for_individual_attribute tool. Multiple values for a key are ORed together. + If you want to filter log messages with a specific substring, you can use Regexes or ExcludeRegexes argument.`, + Handler: tools.GetLogsHandler, }, { - Name: "get_traces", - Description: "Get traces from services running in your Kubernetes cluster in the last 5 minutes, monitored by Metoro", - Handler: tools.GetTracesHandler, + Name: "get_traces", + Description: `Get traces from all or specific services/hosts/pods running in your Kubernetes cluster. Results are limited to 100 traces. How to use this tool: + First, use get_trace_attributes tool to retrieve the available trace attribute keys which can be used as Filter/ExcludeFilter keys. + Then use get_trace_attribute_values_for_individual_attribute tool to get the possible values a trace attribute key can be for filtering traces. + Then you can use this tool (get_traces) to get the specific traces you are looking for. + e.g. Filter use case: get_traces with filters: {key: [value]} for including specific traces. Where key was retrieved from get_trace_attributes tool and value was retrieved from get_trace_attribute_values_for_individual_attribute tool. Multiple values for a key are ORed together. + Regexes and ExcludeRegexes arguments can be used to filter traces endpoints that match the given regexes.`, + Handler: tools.GetTracesHandler, }, { - Name: "get_metric", - Description: "Get metrics from your Kubernetes cluster, monitored by Metoro", - Handler: tools.GetMetricHandler, + Name: "get_metric", + Description: `Get a specific metric's timeseries data. How to use this tool: + First, use get_metric_names tool to retrieve the available metric names which can be used as MetricName argument for this tool. + Then use get_metric_attributes tool to retrieve the available attribute keys and values for a specific MetricName which can be used as Filter/ExcludeFilter keys for this tool. + You can also use Splits argument to group the metric data by the given metric attribute keys.`, + Handler: tools.GetMetricHandler, }, { - Name: "get_trace_metric", - Description: "Get trace metrics from your Kubernetes cluster, monitored by Metoro", - Handler: tools.GetTraceMetricHandler, + Name: "get_trace_metric", + Description: `Get trace data as timeseries. E.g. if you want to see request count, errors, duration/latencies (RED metrics) use this tool to get back the timeseries data. How to use this tool: + First, use get_trace_attributes tool to retrieve the available trace attribute keys which can be used as Filter/ExcludeFilter keys for this tool or the Splits argument to group the data by the given trace attribute keys. + Then use get_trace_attribute_values_for_individual_attribute tool to get the possible values a trace attribute key can be for filtering traces. + Then use get_trace_metric tool to get the timeseries data for the given trace attribute keys and values that you are interested in.`, + Handler: tools.GetTraceMetricHandler, }, { Name: "get_trace_attributes", - Description: "Get trace attributes from your Kubernetes cluster", + Description: "Get the possible trace attribute keys which can be used as Filter/ExcludeFilter keys or Splits for get_traces, get_trace_metric and get_trace_attribute_values_for_individual_attribute tools arguments", Handler: tools.GetTraceAttributesHandler, }, { Name: "get_trace_attribute_values_for_individual_attribute", - Description: "Get trace attribute values for a specific attribute", + Description: "Get trace the possible values a trace attribute key can be used as a value for filtering traces", Handler: tools.GetTraceAttributeValuesForIndividualAttributeHandler, }, { Name: "get_profiles", - Description: "Get profiles from your Kubernetes cluster", + Description: "Get profiles of your services running in your Kubernetes cluster. This tool is useful for answering performance related questions for a specific service. It provides information about which functions taking time in the service.", Handler: tools.GetProfilesHandler, }, { - Name: "get_k8s_events", - Description: "Get Kubernetes events from your clusters with filtering options", - Handler: tools.GetK8sEventsHandler, + Name: "get_k8s_events", + Description: `Get the Kubernetes events from your clusters. Kubernetes events are useful for understanding what is happening in your cluster. + They are emitted by the Kubernetes API server when there is a change in the state of the cluster. How to use this tool: + First, use get_k8s_events_attributes tool to retrieve the available Kubernetes event attribute keys which can be used as Filter/ExcludeFilter keys for this tool. + Then use get_k8s_event_attribute_values_for_individual_attribute tool to get the possible values a Kubernetes event attribute key can be for filtering Kubernetes events. + And then you can call this tool (get_k8s_events) to get the specific events you are looking for. e.g. Filter use case: get_k8s_events with filters: {key: [value]} for including specific Kubernetes events. Where key was retrieved from get_k8s_events_attributes tool and value was retrieved from get_k8s_event_attribute_values_for_individual_attribute tool. Multiple values for a key are ORed together.`, + Handler: tools.GetK8sEventsHandler, }, { Name: "get_k8s_events_attributes", - Description: "Get Kubernetes events attributes", + Description: "Get possible attribute keys for Kubernetes events which can be used for filtering them.", Handler: tools.GetK8sEventsAttributesHandler, }, { Name: "get_k8s_event_attribute_values_for_individual_attribute", - Description: "Get Kubernetes event attribute values for a specific attribute", + Description: "Get possible attribute values for a specific Kubernetes event attribute key. E.g. EventType attribute key might have values like Normal, Warning, etc.", Handler: tools.GetK8sEventAttributeValuesForIndividualAttributeHandler, }, { Name: "get_k8s_events_volume", - Description: "Get Kubernetes events volume", + Description: "Get the timeseries data for the number of Kubernetes events in your cluster, whether its filtered by a specific attribute or not. The volume of events are split by EventType so you can see the breakdown of Warning/Normal events.", Handler: tools.GetK8sEventsVolumeHandler, }, { - Name: "get_metricAttributes", - Description: "Get metric attributes", + Name: "get_metric_attributes", + Description: "Get possible attribute keys and values for a metric which can be used for filtering them.", Handler: tools.GetMetricAttributesHandler, }, { Name: "get_metric_names", - Description: "Get metric names", + Description: "Get available metric names to query. These metric names can be used as MetricName argument for get_metric, get_metric_metadata and get_metric_attributes tools.", Handler: tools.GetMetricNamesHandler, }, { Name: "get_metric_metadata", - Description: "Get metric metadata", + Description: "Get metric metadata tool can be used to get detailed information about a metric including its type, unit and description.", Handler: tools.GetMetricMetadata, }, { Name: "get_pods", - Description: "Get pods information from your Kubernetes cluster", + Description: "Get the pods that are running in your cluster. You must provide either a ServiceName to get pods for a specific service or a NodeName to get pods running on a specific node.", Handler: tools.GetPodsHandler, }, { Name: "get_k8s_service_information", - Description: "Get detailed information about a Kubernetes service including its type (Deployment, DaemonSet, etc.), YAML configuration, and current running replicas (excluding HPA)", + Description: "Get detailed information including the YAML of a Kubernetes service. This tool is useful for understanding the configuration of a service.", Handler: tools.GetK8sServiceInformationHandler, }, { Name: "get_log_attributes", - Description: "Get log attributes", + Description: "Get possible log attribute keys which can be used for filtering logs.", Handler: tools.GetLogAttributesHandler, }, { Name: "get_log_attribute_values_for_individual_attribute", - Description: "Get log attribute values for a specific attribute", + Description: "Get possible values for a specific log attribute key which can be used for filtering logs.", Handler: tools.GetLogAttributeValuesForIndividualAttributeHandler, }, { Name: "get_nodes", - Description: "Get nodes information from your Kubernetes cluster", + Description: "Get the nodes that are running in your cluster. To use this tool, first call get_node_attributes to get the possible node attribute keys and values which can be used for filtering nodes.", Handler: tools.GetNodesHandler, }, + { + Name: "get_node_attributes", + Description: "Get possible node attribute keys and values which can be used for filtering nodes.", + Handler: tools.GetNodeAttributesHandler, + }, { Name: "get_node_info", - Description: "Get detailed node information from your Kubernetes cluster", + Description: "Get detailed node information about a specific node. This tool provides information about the node's capacity, allocatable resources, and usage, yaml, node type, OS and Kernel information.", Handler: tools.GetNodeInfoHandler, }, { Name: "get_service_summaries", - Description: "Get service summaries from your Kubernetes cluster", + Description: "Get summaries of services/workloads running in your Kubernetes cluster. The summary includes the number of requests, errors (5xx and 4xx), P50, p95, p99 latencies. This tool is useful for understanding the performance of your services at a high level for a given relative or abosulute time range.", Handler: tools.GetServiceSummariesHandler, }, { Name: "get_alerts", - Description: "Get alerts from your Kubernetes cluster", + Description: "Get list of alerts from your Kubernetes cluster. These alerts are configured by the user in Metoro therefore it may not have full coverage for all the issues that might occur in the cluster.", Handler: tools.GetAlertsHandler, }, { Name: "get_alert_fires", - Description: "Get alert fires from your Kubernetes cluster", + Description: "Get list of alert fires from your Kubernetes cluster. Alert fires are the instances when an alert is triggered. This tool provides information about the alert name, the time it was triggered, the time it recovered, the environment, and the service name (if available) and the alert trigger message.", Handler: tools.GetAlertFiresHandler, }, } @@ -196,7 +221,7 @@ var metoroResources = []MetoroResource{ { Path: "api://metrics", Name: "metricNames", - Description: "Provides a list of available metric names that can be used for as MetricName arguments to get_metric, get_metric_metadata and get_metricAttributes tools to get metrics data.", + Description: "Provides a list of available metric names that can be used for as MetricName arguments to get_metric, get_metric_metadata and get_metric_attributes tools to get metrics data.", ContentType: "text/plain", Handler: resources.MetricsResourceHandler, }, diff --git a/model/model.go b/model/model.go index 5240eb2..b4329f2 100644 --- a/model/model.go +++ b/model/model.go @@ -62,15 +62,15 @@ const ( type MetricFunction struct { ID string `json:"id"` // The type of the function - FunctionType FunctionType `json:"functionType"` + FunctionType FunctionType `json:"functionType" jsonschema:"required,description=The type of the function to apply to the metric possible values are monotonicDifference / valueDifference / customMathExpression"` // The payload of the function // TODO: If we have more payloads this can be an interface but for now its a math expression since its the only payload. - FunctionPayload MathExpression `json:"functionPayload"` + FunctionPayload MathExpression `json:"functionPayload" jsonschema:"description=The payload of the customMathExpression. this is only set for customMathExpression. "` } type MathExpression struct { - Variables []string `json:"variables"` - Expression string `json:"expression"` + Variables []string `json:"variables" jsonschema:"description=The variables to use in the math expression. For now this should always be ['a'] if set"` + Expression string `json:"expression" jsonschema:"description=The math expression to apply to the metric. For example if you want to divide the metric by 60 you would set the expression as a / 60"` } type FunctionType string diff --git a/tools/get_alert_fires.go b/tools/get_alert_fires.go index dc16bee..3f8e771 100644 --- a/tools/get_alert_fires.go +++ b/tools/get_alert_fires.go @@ -7,8 +7,8 @@ import ( ) type GetAlertFiresHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get alert fires for. e.g. if you want to get fires for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` - AlertId string `json:"alert_id" jsonschema:"required,description=The ID of the alert to get fires for"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get alert fires for. e.g. if you want to get alert fires for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + AlertId string `json:"alert_id" jsonschema:"required,description=The ID of the alert to get the alert fires for"` } func GetAlertFiresHandler(arguments GetAlertFiresHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_k8s_event_attribute_values.go b/tools/get_k8s_event_attribute_values.go index 6a24479..c6a210b 100644 --- a/tools/get_k8s_event_attribute_values.go +++ b/tools/get_k8s_event_attribute_values.go @@ -10,15 +10,14 @@ import ( ) type GetK8sEventAttributeValueHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get the possible values of K8 event attributes values. e.g. if you want to see the possible values for the attributes in the last 5 minutes, you would set time_period=5 and time_window=Minutes"` - Attribute string `json:"attribute" jsonschema:"required,description=The attribute to get values for"` - Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply to the events. it is a map of filter keys to array values where array values are ORed when the filters are applied.e.g. key for service name is service.name"` - ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The exclude filters to exclude/eliminate the events. Events matching the exclude filters will not be returned. it is a map of filter keys to array values where array values are ORed when the filters are applied.e.g. key for service name is service.name"` - Regexes []string `json:"regexes" jsonschema:"description=The regexes to apply to the event messages. Events with messages matching regexes will be returned"` - ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=The regexes to exclude from the event messages. Events with messages matching regexes will be excluded"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get the possible values of K8 event attributes values. e.g. if you want to see the possible values for the attributes in the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + Attribute string `json:"attribute" jsonschema:"required,description=The attribute key to get the possible values for"` + Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply before getting the possible values. For example if you want to get the possible values for attribute key service.name where the environment is X you would set the Filters as {environment: [X]}"` + ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The exclude filters to exclude/eliminate possible values an attribute can take. Events matching the exclude filters will not be returned. For example if you want the possible values for attribute key service.name where the attribute environment is not X then you would set the ExcludeFilters as {environment: [X]}"` + Regexes []string `json:"regexes" jsonschema:"description=The regexes to apply to the event messages. Only the attribute values (for a given attribute key) of events messages that match these regexes will be returned. For example if you want the possible values for attribute key service.name where the event message contains the word 'error' you would set the regexes as ['error']"` + ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=The exclude regexes to apply to the event messages. The attribute values (for a given attribute key) of events messages that match these regexes will not be returned. For example if you want the possible values for attribute key service.name where the event message does not contain the word 'error' you would set the exclude regexes as ['error']"` Environments []string `json:"environments" jsonschema:"description=The environments to get events from. If empty, events from all environments will be returned"` Ascending bool `json:"ascending" jsonschema:"description=If true, events will be returned in ascending order, otherwise in descending order"` - PrevEndTime *float64 `json:"prevEndTime" jsonschema:"description=The end time of the previous request"` } func GetK8sEventAttributeValuesForIndividualAttributeHandler(arguments GetK8sEventAttributeValueHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_k8s_events.go b/tools/get_k8s_events.go index ebdc880..c776835 100644 --- a/tools/get_k8s_events.go +++ b/tools/get_k8s_events.go @@ -10,13 +10,12 @@ import ( ) type GetK8sEventsHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get events for. e.g. if you want to get events for the last 6 hours, you would set time_period=6 and time_window=Hours"` - Filters map[string][]string `json:"filters" jsonschema:"description=Filters to apply to the events"` - ExcludeFilters map[string][]string `json:"exclude_filters" jsonschema:"description=Filters to exclude from the events"` - Regexes []string `json:"regexes" jsonschema:"description=Regexes to apply to the event messages"` - ExcludeRegexes []string `json:"exclude_regexes" jsonschema:"description=Regexes to exclude from the event messages"` - Ascending bool `json:"ascending" jsonschema:"description=If true, events will be returned in ascending order, otherwise in descending order"` - Environments []string `json:"environments" jsonschema:"description=Environments to get events from"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get k8s events for. e.g. if you want to get k8s events for the last 6 hours you would set time_period=6 and time_window=Hours. You can also set an absoulute time range by setting start_time and end_time"` + Filters map[string][]string `json:"filters" jsonschema:"description=Filters to apply to the events. Only the events that match these filters will be returned. Get the possible filter keys from the get_k8s_events_attributes tool and possible filter values from the get_k8s_event_attribute_values tool (for a filter key)"` + ExcludeFilters map[string][]string `json:"exclude_filters" jsonschema:"description=Filters to exclude the events. Events matching the exclude filters will not be returned. Get the possible exclude filter keys from the get_k8s_events_attributes tool and possible exclude filter values from the get_k8s_event_attribute_values tool (for a key)"` + Regexes []string `json:"regexes" jsonschema:"description=Regexes to apply to the event messages. Only the events with messages that match these regexes will be returned. Regexes are ORed together. For example if you want to get events with messages that contain the word 'error' or 'warning' you would set the regexes as ['error' 'warning']"` + ExcludeRegexes []string `json:"exclude_regexes" jsonschema:"description=Regexes to exclude the events. Events with messages that match these regexes will not be returned. Exclude regexes are AND together. For example if you want to get events with messages that do not contain the word 'error' or 'warning' you would set the exclude regexes as ['error' 'warning']"` + Environments []string `json:"environments" jsonschema:"description=Environments/Clusters to get events for"` } func GetK8sEventsHandler(arguments GetK8sEventsHandlerArgs) (*mcpgolang.ToolResponse, error) { @@ -31,7 +30,6 @@ func GetK8sEventsHandler(arguments GetK8sEventsHandlerArgs) (*mcpgolang.ToolResp ExcludeFilters: arguments.ExcludeFilters, Regexes: arguments.Regexes, ExcludeRegexes: arguments.ExcludeRegexes, - Ascending: arguments.Ascending, Environments: arguments.Environments, } diff --git a/tools/get_k8s_events_volume.go b/tools/get_k8s_events_volume.go index 0fd050e..0e8a438 100644 --- a/tools/get_k8s_events_volume.go +++ b/tools/get_k8s_events_volume.go @@ -10,11 +10,11 @@ import ( ) type GetK8sEventsVolumeHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get events for. e.g. if you want to get events for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` - Filters map[string][]string `json:"filters" jsonschema:"description=Filters to apply to the events"` - ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=Filters to exclude from the events"` - Regexes []string `json:"regexes" jsonschema:"description=Regexes to apply to the event messages"` - ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=Regexes to exclude from the event messages"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get events volumes for. e.g. if you want to get events for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + Filters map[string][]string `json:"filters" jsonschema:"description=Filters to apply to the events. Only the event matching these filters will be counted. Get the possible filter keys from the get_k8s_events_attributes tool and possible filter values from the get_k8s_event_attribute_values tool (for a filter key)"` + ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=Filters to exclude the events. Events matching the exclude filters will not be counted. Get the possible exclude filter keys from the get_k8s_events_attributes tool and possible exclude filter values from the get_k8s_event_attribute_values tool (for a key)"` + Regexes []string `json:"regexes" jsonschema:"description=Only the events with messages that match these regexes will be counted"` + ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=Events with messages that match these regexes will not be counted"` Environments []string `json:"environments" jsonschema:"description=Environments to get events from"` } diff --git a/tools/get_k8s_service_information.go b/tools/get_k8s_service_information.go index e9bea8c..ca0d5a7 100644 --- a/tools/get_k8s_service_information.go +++ b/tools/get_k8s_service_information.go @@ -10,9 +10,9 @@ import ( ) type GetK8sServiceInformationHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time to get state of the service. e.g. if you want to see the state of the service 5 minutes ago, you would set time_period=5 and time_window=Minutes"` - ServiceName string `json:"serviceName" jsonschema:"required,description=The name of the service to get information for"` - Environments []string `json:"environments" jsonschema:"description=The environments to get information for. If empty, all environments will be used."` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time to get state of the YAML file. e.g. if you want to see the state of the service 5 minutes ago you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + ServiceName string `json:"serviceName" jsonschema:"required,description=The name of the service to get YAML file for."` + Environments []string `json:"environments" jsonschema:"description=The environments to get service YAML for. If empty all environments will be used."` } func GetK8sServiceInformationHandler(arguments GetK8sServiceInformationHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_log_attribute_values.go b/tools/get_log_attribute_values.go index fc9b61b..d536a18 100644 --- a/tools/get_log_attribute_values.go +++ b/tools/get_log_attribute_values.go @@ -10,13 +10,13 @@ import ( ) type GetLogAttributeValuesHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get log attribute values for. e.g. if you want to get values for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` - Attribute string `json:"attribute" jsonschema:"required,description=The attribute to get values for"` - Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply to the log attribute"` - ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The filters to exclude from the log attribute"` - Regexes []string `json:"regexes" jsonschema:"description=The regexes to apply to the log attribute"` - ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=The regexes to exclude from the log attribute"` - Environments []string `json:"environments" jsonschema:"description=The environments to get logs from"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to use while getting the possible values of log attributes. e.g. if you want to get values for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + Attribute string `json:"attribute" jsonschema:"required,description=The attribute key to get the possible values for"` + Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply before getting the possible values. For example if you want to get the possible values for attribute key service.name where the environment is X you would set the Filters as {environment: [X]}"` + ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The exclude filters to exclude/eliminate possible values an attribute can take. Log attributes matching the exclude filters will not be returned. For example if you want the possible values for attribute key service.name where the attribute environment is not X then you would set the ExcludeFilters as {environment: [X]}"` + Regexes []string `json:"regexes" jsonschema:"description=The regexes to apply to the log messages. Only the attribute values (for a given attribute key) of logs messages that match these regexes will be returned. For example if you want the possible values for attribute key service.name where the log message contains the word 'error' you would set the regexes as ['error']"` + ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=The exclude regexes to apply to the log messages. The attribute values (for a given attribute key) of log messages that match these regexes will not be returned. For example if you want the possible values for attribute key service.name where the log message does not contain the word 'error' you would set the exclude regexes as ['error']"` + Environments []string `json:"environments" jsonschema:"description=The environments to get possible values of a log attributes for. If empty, possible values from all environments will be returned"` } func GetLogAttributeValuesForIndividualAttributeHandler(arguments GetLogAttributeValuesHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_logs.go b/tools/get_logs.go index f171d09..8eaff85 100644 --- a/tools/get_logs.go +++ b/tools/get_logs.go @@ -10,12 +10,11 @@ import ( ) type GetLogsHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get the logs for. e.g. if you want the get the logs for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` - Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply to the logs. it is a map of filter keys to array values where array values are ORed.e.g. key for service name is service.name"` - ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The filters to exclude from the logs. e.g., '{\"service.name\": [\"/k8s/namespaceX/serviceX\"]}' should exclude logs for serviceX in namespaceX"` - Regexes []string `json:"regexes" jsonschema:"description=The regexes to apply to the log's messages. Logs with message matching regexes will be returned"` - ExcludeRegexes []string `json:"excludeRegexes" jsonshcema:"description=The regexes to exclude from the log's messages. Logs with message matching regexes will be excluded"` - Ascending bool `json:"ascending" jsonschema:"description=If true, logs will be returned in ascending order, otherwise in descending order"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get the logs for. e.g. if you want the get the logs for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + Filters map[string][]string `json:"filters" jsonschema:"description=Filters to apply to the logs. Only the logs that match these filters will be returned. Get the possible filter keys from the get_log_attributes tool and possible values of a filter key from the get_log_attribute_values_for_individual_attribute tool. e.g. {service.name: [/k8s/namespaceX/serviceX]} should return logs for serviceX in namespaceX"` + ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=Filters to exclude the logs. Logs matching the exclude filters will not be returned. Get the possible exclude filter keys from the get_log_attributes tool and possible exclude filter values from the get_log_attribute_values_for_individual_attribute tool (for a key). e.g. {service.name: [/k8s/namespaceX/serviceX]} should exclude logs for serviceX in namespaceX"` + Regexes []string `json:"regexes" jsonschema:"description=Regexes to apply to the log messages. Only the logs with messages that match these regexes will be returned. Regexes are ORed together. For example if you want to get logs with message that contains the word 'error' or 'warning' you would set the regexes as ['error' 'warning']"` + ExcludeRegexes []string `json:"excludeRegexes" jsonshcema:"description=Regexes to exclude the log. Log messages that match these regexes will not be returned. Exclude regexes are AND together. For example if you want to get logs with messages that do not contain the word 'error' or 'warning' you would set the exclude regexes as ['error' 'warning']"` Environments []string `json:"environments" jsonschema:"description=The environments to get logs from. If empty, logs from all environments will be returned"` } @@ -32,7 +31,6 @@ func GetLogsHandler(arguments GetLogsHandlerArgs) (*mcpgolang.ToolResponse, erro ExcludeFilters: arguments.ExcludeFilters, Regexes: arguments.Regexes, ExcludeRegexes: arguments.ExcludeRegexes, - Ascending: arguments.Ascending, Environments: arguments.Environments, } diff --git a/tools/get_metric.go b/tools/get_metric.go index db6cd2a..b78dee7 100644 --- a/tools/get_metric.go +++ b/tools/get_metric.go @@ -10,15 +10,14 @@ import ( ) type GetMetricHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get the metric/timeseries data for. e.g. if you want to get the timeseries/metric data for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` - MetricName string `json:"metricName" jsonschema:"required,description=The name of the metric to get"` - Aggregation model.Aggregation `json:"aggregation" jsonschema:"required,description=The aggregation to apply to the metric. e.g. sum, avg, min, max, count"` - Filters map[string][]string `json:"filters" jsonschema:"description=Filters to apply to the metric. Metrics matching the filters will be returned"` - ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=Exclude filters to apply to the metric. Metrics matching the exclude filters will not be returned"` - Splits []string `json:"splits" jsonschema:"description=The splits to apply to the metric. Metrics will be split by the given keys"` - Functions []model.MetricFunction `json:"functions" jsonschema:"description=The functions to apply to the metric"` - LimitResults bool `json:"limitResults" jsonschema:"description=If true, the results will be limited to improve performance"` - BucketSize int64 `json:"bucketSize" jsonschema:"description=The size of each datapoint bucket in seconds, if not provided metoro will select the best bucket size for the given duration for performance and clarity"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get the metric/timeseries data for. e.g. if you want to get the timeseries/metric data for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + MetricName string `json:"metricName" jsonschema:"required,description=The name of the metric to use for getting the timeseries data"` + Aggregation model.Aggregation `json:"aggregation" jsonschema:"required,description=The aggregation to apply to the metrics. Possible values are: sum / avg / min / max / count. The aggregation will be applied to every datapoint bucket. For example if the bucket size is 1 minute and the aggregation is sum then the sum of all datapoints in a minute will be returned"` + Filters map[string][]string `json:"filters" jsonschema:"description=Filters to apply to the metrics. Only the metrics that match these filters will be returned. Get the possible filter keys and values the get_metric_attributes tool. e.g. {service_name: [/k8s/namespaceX/serviceX]} should return metrics for serviceX in namespaceX"` + ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=Filters to exclude the metrics. Metrics matching the exclude filters will not be returned. Get the possible exclude filter keys and values from the get_metric_attributes tool. e.g. {service_name: [/k8s/namespaceX/serviceX]} should exclude metrics from serviceX in namespaceX"` + Splits []string `json:"splits" jsonschema:"description=Splits will allow you to group/split metrics by an attribute. This is useful if you would like to see the breakdown of a particular metric by an attribute. For example if you want to see the breakdown of the metric by service_name you would set the splits as ['service_name']"` + Functions []model.MetricFunction `json:"functions" jsonschema:"description=The functions to apply to the metric. Available functions are monotonicDifference which will calculate the difference between the current and previous value of the metric (negative values will be set to 0) and valueDifference which will calculate the difference between the current and previous value of the metric or MathExpression e.g. a / 60"` + BucketSize int64 `json:"bucketSize" jsonschema:"description=The size of each datapoint bucket in seconds if not provided metoro will select the best bucket size for the given duration for performance and clarity"` } func GetMetricHandler(arguments GetMetricHandlerArgs) (*mcpgolang.ToolResponse, error) { @@ -35,7 +34,6 @@ func GetMetricHandler(arguments GetMetricHandlerArgs) (*mcpgolang.ToolResponse, Splits: arguments.Splits, Aggregation: arguments.Aggregation, Functions: arguments.Functions, - LimitResults: arguments.LimitResults, BucketSize: arguments.BucketSize, } diff --git a/tools/get_metric_attributes.go b/tools/get_metric_attributes.go index 7bf81d5..1d058e4 100644 --- a/tools/get_metric_attributes.go +++ b/tools/get_metric_attributes.go @@ -10,9 +10,9 @@ import ( ) type GetMetricAttributesHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"timeConfig" jsonschema:"required,description=The time period to get the possible values of metric attributes"` - MetricName string `json:"metricName" jsonschema:"required,description=The name of the metric to get attributes for"` - FilterAttributes map[string][]string `json:"filterAttributes" jsonschema:"description=The attributes to filter the metric attributes by"` + TimeConfig utils.TimeConfig `json:"timeConfig" jsonschema:"required,description=The time period to get the possible values of metric attributes for. e.g. if you want to get the possible values for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + MetricName string `json:"metricName" jsonschema:"required,description=The name of the metric to get the possible attribute keys and values."` + FilterAttributes map[string][]string `json:"filterAttributes" jsonschema:"description=The attributes to filter the metric attributes by before getting the possible values. For example if you want to get the possible keys and values where the environment is X you would set the filterAttributes as {environment: [X]}"` } func GetMetricAttributesHandler(arguments GetMetricAttributesHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_metric_names.go b/tools/get_metric_names.go index 05b71a6..aee9084 100644 --- a/tools/get_metric_names.go +++ b/tools/get_metric_names.go @@ -11,7 +11,7 @@ import ( ) type GetMetricNamesHandlerArgs struct { - Environments []string `json:"environments" jsonschema:"description=Environments to get metrics from. If empty, all environments will be used."` + Environments []string `json:"environments" jsonschema:"description=Environments to get metrics names from. If empty all environments will be used."` } func GetMetricNamesHandler(arguments GetMetricNamesHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_node_attributes.go b/tools/get_node_attributes.go new file mode 100644 index 0000000..84dd0b6 --- /dev/null +++ b/tools/get_node_attributes.go @@ -0,0 +1,30 @@ +package tools + +import ( + "fmt" + mcpgolang "github.com/metoro-io/mcp-golang" + "github.com/metoro-io/metoro-mcp-server/model" + "github.com/metoro-io/metoro-mcp-server/utils" +) + +type GetNodeAttributesHandlerArgs struct { + TimeConfig utils.TimeConfig `json:"timeConfig" jsonschema:"required,description=The time range to get the node attributes for"` +} + +func GetNodeAttributesHandler(arguments GetNodeAttributesHandlerArgs) (*mcpgolang.ToolResponse, error) { + startTime, endTime, err := utils.CalculateTimeRange(arguments.TimeConfig) + if err != nil { + return nil, fmt.Errorf("error calculating time range: %v", err) + } + request := model.MetricAttributesRequest{ + StartTime: startTime, + EndTime: endTime, + MetricName: "node_info", + FilterAttributes: map[string][]string{}, + } + response, err := getMetricAttributesMetoroCall(request) + if err != nil { + return nil, fmt.Errorf("error calling Metoro API: %v", err) + } + return mcpgolang.NewToolReponse(mcpgolang.NewTextContent(fmt.Sprintf("%s", string(response)))), nil +} diff --git a/tools/get_node_info.go b/tools/get_node_info.go index 8c3d37d..eed20d5 100644 --- a/tools/get_node_info.go +++ b/tools/get_node_info.go @@ -8,7 +8,7 @@ import ( ) type GetNodeInfoHandlerArgs struct { - NodeName string `json:"nodeName" jsonschema:"required,description=The name of the node to get info for"` + NodeName string `json:"nodeName" jsonschema:"required,description=The name of the node to get the YAML/information for"` } func GetNodeInfoHandler(arguments GetNodeInfoHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_nodes.go b/tools/get_nodes.go index 3e6a662..50c042a 100644 --- a/tools/get_nodes.go +++ b/tools/get_nodes.go @@ -10,11 +10,10 @@ import ( ) type GetNodesHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get nodes for. e.g. if you want to get nodes for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` - Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply to the nodes"` - ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The filters to exclude from the nodes"` - Splits []string `json:"splits" jsonschema:"description=The splits to apply to the nodes"` - Environments []string `json:"environments" jsonschema:"description=The environments to get nodes from"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get nodes for. e.g. if you want to get nodes for the last 5 minutes you would set time_period=5 and time_window=Minutes or if you want to get nodes for the last 2 hours you would set time_period=2 and time_window=Hours. You can also set an absoulute time range by setting start_time and end_time"` + Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply to the nodes. Only the nodes that match these filters will be returned. To get possible filter keys and values use the get_node_attributes tool."` + ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The filters to exclude the nodes. Nodes matching the exclude filters will not be returned. To get possible exclude filter keys and values use the get_node_attributes tool."` + Environments []string `json:"environments" jsonschema:"description=The environments to get nodes that belong to. If empty all environments will be used."` } func GetNodesHandler(arguments GetNodesHandlerArgs) (*mcpgolang.ToolResponse, error) { @@ -27,7 +26,7 @@ func GetNodesHandler(arguments GetNodesHandlerArgs) (*mcpgolang.ToolResponse, er EndTime: endTime, Filters: arguments.Filters, ExcludeFilters: arguments.ExcludeFilters, - Splits: arguments.Splits, + Splits: []string{}, Environments: arguments.Environments, } body, err := getNodesMetoroCall(request) diff --git a/tools/get_pods.go b/tools/get_pods.go index fddcffb..30fd861 100644 --- a/tools/get_pods.go +++ b/tools/get_pods.go @@ -10,7 +10,7 @@ import ( ) type GetPodsHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get pods for. e.g. if you want to get pods for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get pods for. e.g. if you want to get pods for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` ServiceName string `json:"serviceName" jsonschema:"description=The name of the service to get pods for. One of serviceName or nodeName is required"` NodeName string `json:"nodeName" jsonschema:"description=The name of the node to get pods for. One of serviceName or nodeName is required"` Environments []string `json:"environments" jsonschema:"description=The environments to get pods for. If empty, all environments will be used."` diff --git a/tools/get_profiles.go b/tools/get_profiles.go index 91466ec..7add04c 100644 --- a/tools/get_profiles.go +++ b/tools/get_profiles.go @@ -10,7 +10,7 @@ import ( ) type GetProfileHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get profiles for. e.g. if you want to get profiles for the last 5 minutes, you would set time_period=5 and time_window=Minutes."` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get the profiles data. e.g. if you want to get profiles for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` ServiceName string `json:"serviceName" jsonschema:"required,description=The name of the service to get profiles for"` ContainerNames []string `json:"containerNames" jsonschema:"description=The container names to get profiles for"` } diff --git a/tools/get_service_summaries.go b/tools/get_service_summaries.go index ae7cbff..19099b2 100644 --- a/tools/get_service_summaries.go +++ b/tools/get_service_summaries.go @@ -10,9 +10,9 @@ import ( ) type GetServiceSummariesHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get service summaries for. e.g. if you want to get summaries for the last 5 minutes, you would set time_period=5 and time_window=Minutes. Try to use a time period 1 hour or less"` - Namespaces string `json:"namespace" jsonschema:"description=The namespace to get service summaries for. If empty, all namespaces will be used."` - Environments []string `json:"environments" jsonschema:"description=The environments to get service summaries for. If empty, all environments will be used."` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get service summaries for. e.g. if you want to get summaries for the last 5 minutes you would set time_period=5 and time_window=Minutes. Try to use a time period 1 hour or less. You can also set an absoulute time range by setting start_time and end_time"` + Namespaces string `json:"namespace" jsonschema:"description=The namespace to get service summaries for. If empty all namespaces will be used."` + Environments []string `json:"environments" jsonschema:"description=The environments to get service summaries for. If empty all environments will be used."` } func GetServiceSummariesHandler(arguments GetServiceSummariesHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_trace_attribute_values.go b/tools/get_trace_attribute_values.go index fdc751b..5a9e82a 100644 --- a/tools/get_trace_attribute_values.go +++ b/tools/get_trace_attribute_values.go @@ -10,15 +10,13 @@ import ( ) type GetTraceAttributeValuesHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to use for getting the possible trace attributes values. e.g. if you want to get possible trace attribute for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` - Attribute string `json:"attribute" jsonschema:"required,description=The name of the attribute to get values for"` - ServiceNames []string `json:"serviceNames" jsonschema:"description=The service names to get attribute values for"` - // TODO: I don't think we need these two fields for the LLM tool - Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply to the traces. it is a map of filter keys to array values where array values are ORed when the filters are applied.e.g. key for service name is service.name"` - ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The exclude filters to exclude/eliminate the traces. Traces matching the exclude traces will not be returned. it is a map of filter keys to array values where array values are ORed when the filters are applied.e.g. key for service name is service.name"` - Regexes []string `json:"regexes" jsonschema:"description=The regexes to apply to the trace's endpoints. Traces with endpoints matching regexes will be returned"` - ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=The regexes to exclude from the trace's endpoints. Traces with endpoints matching regexes will be excluded"` - Environments []string `json:"environments" jsonschema:"description=The environments to get traces from. If empty, traces from all environments will be returned"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to use for getting the possible values for a trace attribute key. e.g. if you want to get possible trace attribute values for key x for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + Attribute string `json:"attribute" jsonschema:"required,description=The name of the attribute key to get the possible values for"` + Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply before getting the possible values. For example if you want to get the possible values for attribute key service.name where the environment is X you would set the Filters as {environment: [X]}"` + ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The exclude filters to exclude/eliminate possible values an attribute can take. Traces matching the exclude filters will not be returned. For example if you want the possible values for attribute key service.name where the attribute environment is not X then you would set the ExcludeFilters as {environment: [X]}"` + Regexes []string `json:"regexes" jsonschema:"description=The regexes to apply to the trace endpoint. Only the attribute values (for a given attribute key) of trace endpoint that match these regexes will be returned. For example if you want the possible values for attribute key service.name where the trace endpoint contains the word 'get' you would set the regexes as ['get']"` + ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=The exclude regexes to apply to the trace endpoint. The attribute values (for a given attribute key) of trace endpoint that match these regexes will not be returned. For example if you want the possible values for attribute key service.name where the trace endpoint does not contain the word 'get' you would set the exclude regexes as ['get']"` + Environments []string `json:"environments" jsonschema:"description=The environments to get traces from. If empty traces from all environments will be returned"` } func GetTraceAttributeValuesForIndividualAttributeHandler(arguments GetTraceAttributeValuesHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_trace_metric.go b/tools/get_trace_metric.go index 78fe053..699f8e5 100644 --- a/tools/get_trace_metric.go +++ b/tools/get_trace_metric.go @@ -10,16 +10,16 @@ import ( ) type GetTraceMetricHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get traces for. e.g. if you want to get traces for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` - ServiceNames []string `json:"serviceNames" jsonschema:"description=Service names to return traces for"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get the trace timeseries data for. e.g. if you want to get the trace timeseries data for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time"` + ServiceNames []string `json:"serviceNames" jsonschema:"description=Service names to return the trace timeseries data for"` Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply to the traces. it is a map of filter keys to array values where array values are ORed.e.g. key for service name is service.name"` ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The exclude filters to exclude/eliminate the traces. Traces matching the exclude traces will not be returned. it is a map of filter keys to array values where array values are ORed.e.g. key for service name is service.name"` Regexes []string `json:"regexes" jsonschema:"description=The regexes to apply to the trace's endpoints. Traces with endpoints matching regexes will be returned"` ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=The regexes to exclude from the trace's endpoints. Traces with endpoints matching regexes will be excluded"` - Splits []string `json:"splits" jsonschema:"description=The splits to apply to the metric. Metrics will be split by the given keys"` - Functions []model.MetricFunction `json:"functions" jsonschema:"description=The functions to apply to the metric"` - Aggregate string `json:"aggregate" jsonschema:"description=The aggregation to apply to the metric. e.g. sum, avg, min, max, count"` - Environments []string `json:"environments" jsonschema:"description=The environments to get traces from. If empty, traces from all environments will be returned"` + Splits []string `json:"splits" jsonschema:"description=The splits to apply to trace timeseries data. e.g. if you want to split the trace timeseries data by service name you would set splits as ['service.name']. This is useful for seeing a breakdown of the trace timeseries data by an attribute"` + Functions []model.MetricFunction `json:"functions" jsonschema:"description=The functions to apply to the traces. Available functions are monotonicDifference which will calculate the difference between the current and previous value of the metric (negative values will be set to 0) and valueDifference which will calculate the difference between the current and previous value of the metric or MathExpression e.g. a / 60"` + Aggregate string `json:"aggregate" jsonschema:"required,description=The aggregation to apply to the metrics. Possible values are: count / p50 / p90 / p95 / p99 / totalSize / responseSize / requestSize. The aggregation will be applied to every datapoint bucket. For example if the bucket size is 1 minute and the aggregation is count then the count of all datapoints in a minute will be returned"` + Environments []string `json:"environments" jsonschema:"description=The environments to get traces from. If empty traces from all environments will be returned"` } func GetTraceMetricHandler(arguments GetTraceMetricHandlerArgs) (*mcpgolang.ToolResponse, error) { diff --git a/tools/get_traces.go b/tools/get_traces.go index c41bac1..664e450 100644 --- a/tools/get_traces.go +++ b/tools/get_traces.go @@ -10,14 +10,13 @@ import ( ) type GetTracesHandlerArgs struct { - TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get traces for. e.g. if you want to get traces for the last 5 minutes, you would set time_period=5 and time_window=Minutes"` + TimeConfig utils.TimeConfig `json:"time_config" jsonschema:"required,description=The time period to get traces for. e.g. if you want to get traces for the last 5 minutes you would set time_period=5 and time_window=Minutes. You can also set an absoulute time range by setting start_time and end_time. Try to use a time period 24 hours or less unless its requested."` ServiceNames []string `json:"serviceNames" jsonschema:"description=Service names to return traces for"` - Filters map[string][]string `json:"filters" jsonschema:"description=The filters to apply to the traces. it is a map of filter keys to array values where array values are ORed.e.g. key for service name is service.name"` - ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The exclude filters to exclude/eliminate the traces. Traces matching the exclude traces will not be returned. it is a map of filter keys to array values where array values are ORed.e.g. key for service name is service.name"` + Filters map[string][]string `json:"filters" jsonschema:"description=Filters to apply to the traces. Only the traces that match these filters will be returned. Get the possible filter keys from the get_trace_attributes tool and possible values of a filter key from the get_trace_attribute_values_for_individual_attribute tool"` + ExcludeFilters map[string][]string `json:"excludeFilters" jsonschema:"description=The exclude filters to exclude/eliminate the traces. Traces matching the exclude traces will not be returned. Get the possible exclude filter keys from the get_trace_attributes tool and possible value for the key from the get_trace_attribute_values_for_individual_attribute tool"` Regexes []string `json:"regexes" jsonschema:"description=The regexes to apply to the trace's endpoints. Traces with endpoints matching regexes will be returned"` ExcludeRegexes []string `json:"excludeRegexes" jsonschema:"description=The regexes to exclude from the trace's endpoints. Traces with endpoints matching regexes will be excluded"` - Ascending bool `json:"ascending" jsonschema:"description=If true, traces will be returned in ascending order, otherwise in descending order"` - Environments []string `json:"environments" jsonschema:"description=The environments to get traces from. If empty, traces from all environments will be returned"` + Environments []string `json:"environments" jsonschema:"description=The environments to get traces from. If empty traces from all environments will be returned"` } func GetTracesHandler(arguments GetTracesHandlerArgs) (*mcpgolang.ToolResponse, error) { @@ -32,7 +31,6 @@ func GetTracesHandler(arguments GetTracesHandlerArgs) (*mcpgolang.ToolResponse, Filters: arguments.Filters, ExcludeFilters: arguments.ExcludeFilters, Regexes: arguments.Regexes, - Ascending: arguments.Ascending, Environments: arguments.Environments, }