Documentation
¶
Index ¶
- func AllTools() []mcp.Tool
- func CreateExecuteInstantQueryTool() mcp.Tool
- func CreateExecuteRangeQueryTool() mcp.Tool
- func CreateGetAlertsTool() mcp.Tool
- func CreateGetLabelNamesTool() mcp.Tool
- func CreateGetLabelValuesTool() mcp.Tool
- func CreateGetSeriesTool() mcp.Tool
- func CreateGetSilencesTool() mcp.Tool
- func CreateListMetricsTool() mcp.Tool
- func CreateShowTimeseriesTool() mcp.Tool
- func ExecuteInstantQueryHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.InstantQueryInput, tools.InstantQueryOutput]
- func ExecuteRangeQueryHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.RangeQueryInput, tools.RangeQueryOutput]
- func GetAlertsHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.AlertsInput, tools.AlertsOutput]
- func GetLabelNamesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.LabelNamesInput, tools.LabelNamesOutput]
- func GetLabelValuesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.LabelValuesInput, tools.LabelValuesOutput]
- func GetSeriesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.SeriesInput, tools.SeriesOutput]
- func GetSilencesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.SilencesInput, tools.SilencesOutput]
- func ListMetricsHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.ListMetricsInput, tools.ListMetricsOutput]
- func NewMCPServer(opts ObsMCPOptions) (*mcp.Server, error)
- func Serve(ctx context.Context, mcpServer *mcp.Server, listenAddr string) error
- func SetupTools(mcpServer *mcp.Server, opts ObsMCPOptions) error
- func ShowTimeseriesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.ShowTimeseriesInput, struct{}]
- type AuthMode
- type ContextKey
- type ObsMCPOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllTools ¶
AllTools returns all available MCP tools. When adding a new tool, add it to pkg/tools/definitions.go to keep both MCP and Toolset in sync, as well as docs.
func CreateGetAlertsTool ¶
func CreateGetLabelNamesTool ¶
func CreateGetSeriesTool ¶
func CreateGetSilencesTool ¶
func CreateListMetricsTool ¶
Individual tool creation functions for backward compatibility and testing
func ExecuteInstantQueryHandler ¶
func ExecuteInstantQueryHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.InstantQueryInput, tools.InstantQueryOutput]
ExecuteInstantQueryHandler handles the execution of Prometheus instant queries.
func ExecuteRangeQueryHandler ¶
func ExecuteRangeQueryHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.RangeQueryInput, tools.RangeQueryOutput]
ExecuteRangeQueryHandler handles the execution of Prometheus range queries.
func GetAlertsHandler ¶
func GetAlertsHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.AlertsInput, tools.AlertsOutput]
GetAlertsHandler handles the retrieval of alerts from Alertmanager.
func GetLabelNamesHandler ¶
func GetLabelNamesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.LabelNamesInput, tools.LabelNamesOutput]
GetLabelNamesHandler handles the retrieval of label names.
func GetLabelValuesHandler ¶
func GetLabelValuesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.LabelValuesInput, tools.LabelValuesOutput]
GetLabelValuesHandler handles the retrieval of label values.
func GetSeriesHandler ¶
func GetSeriesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.SeriesInput, tools.SeriesOutput]
GetSeriesHandler handles the retrieval of time series.
func GetSilencesHandler ¶
func GetSilencesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.SilencesInput, tools.SilencesOutput]
GetSilencesHandler handles the retrieval of silences from Alertmanager.
func ListMetricsHandler ¶
func ListMetricsHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.ListMetricsInput, tools.ListMetricsOutput]
ListMetricsHandler handles the listing of available Prometheus metrics.
func NewMCPServer ¶
func NewMCPServer(opts ObsMCPOptions) (*mcp.Server, error)
func SetupTools ¶
func SetupTools(mcpServer *mcp.Server, opts ObsMCPOptions) error
func ShowTimeseriesHandler ¶
func ShowTimeseriesHandler(opts ObsMCPOptions) mcp.ToolHandlerFor[tools.ShowTimeseriesInput, struct{}]
ShowTimeseriesHandler handles the show_timeseries tool.
Types ¶
type AuthMode ¶
type AuthMode string
AuthMode defines the authentication mode for Prometheus client
func ParseAuthMode ¶
ParseAuthMode validates and converts a string to AuthMode
type ContextKey ¶
type ContextKey string
const ( // AuthHeaderKey is the context key for the authorization header AuthHeaderKey ContextKey = "Authorization" // TestPromClientKey is the context key for injecting a test Prometheus client TestPromClientKey ContextKey = "test-prometheus-client" // TestAlertmanagerClientKey is the context key for injecting a test Alertmanager client TestAlertmanagerClientKey ContextKey = "test-alertmanager-client" )
type ObsMCPOptions ¶
type ObsMCPOptions struct {
AuthMode AuthMode
MetricsBackendURL string
AlertmanagerURL string
Insecure bool
Guardrails *prometheus.Guardrails
FullRangeQueryResponse bool
}
ObsMCPOptions contains configuration options for the MCP server