list_sources
Check configured observability backends and their reachability before running queries. Returns source names, types, URLs, signal types, and live up/down status.
Instructions
List the configured observability backends (Prometheus, Loki, and any connector) and whether each is currently reachable. When to use: call this first to learn which source names exist and are healthy before passing source to other tools, or to debug why a query returns no data. Behavior: read-only, no side effects. Returns one entry per source with its name, type, configured URL, signal types (metrics/logs), and a live up/down status. Never throws for an unreachable backend — the backend is reported as down instead. Related: use list_services to see what is monitored within these sources.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The actual handler function that executes the list_sources tool logic. Calls registry.healthCheckAll() and registry.getAll(), then returns the list of sources with their status.
export async function listSourcesHandler( registry: ConnectorRegistry, _ctx: RequestContext = defaultContext() ) { const healthResults = await registry.healthCheckAll(); const connectors = registry.getAll(); const sources = connectors.map((c) => ({ name: c.name, type: c.type, signalType: c.signalType, status: healthResults[c.name]?.status || "unknown", latencyMs: healthResults[c.name]?.latencyMs, })); return { content: [ { type: "text" as const, text: JSON.stringify({ sources }, null, 2), }, ], }; } - The tool definition/schema for list_sources, including name, description, and inputSchema (no parameters needed).
export const listSourcesDefinition = { name: "list_sources" as const, description: "List all configured observability backends and their connection status. Use this to discover what data sources are available.", inputSchema: { type: "object" as const, properties: {}, }, }; - mcp-server/src/index.ts:140-150 (registration)Registration of the list_sources tool with the MCP server via mcpServer.tool(), wrapping the handler with withToolMetrics.
mcpServer.tool( "list_sources", [ "List the configured observability backends (Prometheus, Loki, and any connector) and whether each is currently reachable.", "When to use: call this first to learn which source names exist and are healthy before passing `source` to other tools, or to debug why a query returns no data.", "Behavior: read-only, no side effects. Returns one entry per source with its name, type, configured URL, signal types (metrics/logs), and a live up/down status. Never throws for an unreachable backend — the backend is reported as down instead.", "Related: use `list_services` to see what is monitored within these sources.", ].join(" "), {}, async () => withToolMetrics("list_sources", () => listSourcesHandler(registry, ctx)) ); - mcp-server/src/index.ts:29-29 (registration)Import statement that brings listSourcesHandler into the main index.ts where the tool is registered.
import { listSourcesHandler } from "./tools/list-sources.js";