UNPKG

openclaw-grafana-lens

Version:

OpenClaw plugin that gives AI agents full Grafana access — 18 composable tools for PromQL/LogQL/TraceQL queries, dashboard creation, alerting, SRE investigation, security monitoring, data collection pipeline management via Grafana Alloy (29 recipes), and

42 lines (41 loc) 1.5 kB
/** * grafana_explore_datasources tool * * Discovers what datasources are configured in Grafana. This is the * agent's starting point for understanding what data is available — * it provides the datasource UIDs needed by grafana_query and * grafana_list_metrics, plus routing hints for which tool to use. */ import type { GrafanaClientRegistry } from "../grafana-client-registry.js"; export type QueryToolName = "grafana_query" | "grafana_query_logs" | "grafana_query_traces"; export type QueryLanguageName = "PromQL" | "LogQL" | "TraceQL"; /** Discriminated union: supported datasources have non-null tool+language, unsupported have null. */ export type QueryCapability = { queryTool: QueryToolName; queryLanguage: QueryLanguageName; supported: true; } | { queryTool: null; queryLanguage: null; supported: false; }; /** Returns routing hints for a datasource type, or an unsupported fallback. */ export declare function getQueryCapability(dsType: string): QueryCapability; export declare function createExploreDatasourcesToolFactory(registry: GrafanaClientRegistry): (_ctx: unknown) => { name: string; label: string; description: string; parameters: { type: "object"; properties: { [x: string]: unknown; }; }; execute(_toolCallId: string, _params: Record<string, unknown>): Promise<{ content: Array<{ type: "text"; text: string; }>; details: unknown; }>; };