prometheus_build_info
Retrieve detailed build information for Prometheus, enabling users to monitor and analyze version-specific metrics within their infrastructure efficiently.
Instructions
Get Prometheus build information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server/tools.ts:160-168 (registration)Registration of the prometheus_build_info tool, defining its metadata, empty input schema, and handler that delegates to PrometheusClient.getBuildInfo()defineTool<typeof EmptySchema, BuildInfo>({ capability: "info", name: "prometheus_build_info", title: "Get Build Info", description: "Get Prometheus build information", inputSchema: EmptySchema, type: "readonly", handle: async (client: PrometheusClient) => client.getBuildInfo(), }),
- src/server/tools.ts:76-76 (schema)Empty input schema used by prometheus_build_info and other parameterless toolsconst EmptySchema = z.object({});
- src/prometheus/client.ts:293-296 (helper)Helper method in PrometheusClient that fetches build information from the Prometheus /api/v1/status/buildinfo endpoint using the generic request methodasync getBuildInfo(): Promise<BuildInfo> { const endpoint = "/api/v1/status/buildinfo"; return this.request<BuildInfo>(endpoint); }
- src/prometheus/client.ts:52-92 (helper)Generic HTTP request helper used by all Prometheus API calls, including getBuildInfo, handling fetch, error checking, and response parsingprivate 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; }