prometheus_runtime_info
Retrieve Prometheus runtime details to monitor and analyze system performance. Supports integration with AI assistants for efficient querying and metric discovery.
Instructions
Get Prometheus runtime information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server/tools.ts:151-159 (registration)Registration and definition of the prometheus_runtime_info MCP tool, including its name, description, empty input schema, and thin handler that delegates to PrometheusClient.getRuntimeInfo()defineTool<typeof EmptySchema, RuntimeInfo>({ capability: "info", name: "prometheus_runtime_info", title: "Get Runtime Info", description: "Get Prometheus runtime information", inputSchema: EmptySchema, type: "readonly", handle: async (client: PrometheusClient) => client.getRuntimeInfo(), }),
- src/server/tools.ts:76-76 (schema)Empty input schema (z.object({})) used by the prometheus_runtime_info tool and others requiring no parametersconst EmptySchema = z.object({});
- src/prometheus/client.ts:276-279 (handler)Implementation of the getRuntimeInfo method called by the tool handler, which performs an HTTP GET request to the Prometheus /api/v1/status/runtimeinfo endpoint using the client's internal request methodasync getRuntimeInfo(): Promise<RuntimeInfo> { const endpoint = "/api/v1/status/runtimeinfo"; return this.request<RuntimeInfo>(endpoint); }
- src/prometheus/client.ts:52-92 (helper)Internal request helper method used by getRuntimeInfo to make authenticated HTTP requests to Prometheus API with proper error handling and loggingprivate async request<T>( endpoint: string, params?: Record<string, string>, ): Promise<T> { const url = new URL(endpoint, this.baseUrl); const queryParams = new URLSearchParams(params); if (queryParams) { url.search = queryParams.toString(); } logger.debug("making prometheus request", { endpoint, url }); try { const response = await fetch(url.toString(), { method: "GET", headers: this.headers, }); if (!response.ok) { const error = `http ${response.status}: ${response.statusText}`; logger.error(error, { endpoint, status: response.status }); throw new Error(error); } const result: Response<T> = await response.json(); if (result.status !== "success") { const errorMsg = result.error || "unknown error"; const error = `prometheus api error: ${errorMsg}`; logger.error(error, { endpoint, status: result.status }); throw new Error(error); } logger.debug("prometheus request successful", { endpoint }); return result.data; } catch (error) { logger.error("prometheus request failed", { endpoint, error: error instanceof Error ? error.message : String(error), }); throw error; }