How do I ask an AI agent what moved in Prometheus metrics for a service?
Tares answers this when you connect your MCP client and ask about the service, and the read returns its Prometheus readings next to alerts and logs. You pick the metrics once, Tares polls them, and the agent reads one correlated timeline. You never write PromQL.
How it works
Two pieces make this work: a Prometheus source that stores the readings, and an MCP connection that lets your agent read them.
- The
prometheusconnector polls the metrics you pick, by name or by a label they carry. Each series becomes a metric event on every poll tick. - The metric value is stored as a number-typed
valuelabel. Triggers can aggregate it withmax,avgorsum. - Events share a key with your logs, deploys and alerts, so they line up on the same entity.
- Your MCP client discovers the Tares tools. The
readtool returns a correlated, time-ordered timeline across all sources that match a label selector, for example the service name. catalog_listandcatalog_describeshow what is ingested and each source’s labels, freshness and sample events.statscounts a label’s values over a project’s sources, this window against the one before. It helps when you want to see what changed.
For how this fits a wider on-call workflow, see AI SRE.
Set it up
- Add the Prometheus source. In the console go to Sources, Add source, Prometheus. Enter the
urland any auth, run Discover, then tick the metrics you want by name or by label. You can also ask a connected agent: “Use tares to ingest the pg_* metrics from the Prometheus at localhost:9090.” The generated config looks like this:
- name: metrics
connector: prometheus
poll: 10s
config:
url: http://localhost:9090
queries:
- promql: '{__name__=~"(pg_stat_database_xact_commit|pg_up)"}' # generated from your picks
by_name: true
labels:
- { name: service, field: metric.service, primary: true }
- { name: value, field: value, type: number } # the metric value, aggregate it in triggers- Start the MCP endpoint. On a local Tares, the daemon alone does not serve
/mcp. Start Tares, then run the MCP server in a second terminal:
tares up
tares mcp --transport streamable-httpYour local endpoint is http://localhost:8788/mcp. On your own server it is the /mcp path on your domain. On Tares Cloud the console’s Connect page shows it, and there is nothing to start.
- Connect your client. For Claude Code, install the Tares plugin, which is the default path. For Cursor, add the server to
~/.cursor/mcp.jsonor.cursor/mcp.json, then approve it under Settings, MCP:
{
"mcpServers": {
"tares": {
"url": "http://localhost:8788/mcp"
}
}
}Codex and any other MCP client that supports remote servers connect over streamable HTTP with the same URL. The agents page has the exact command for each client. On a secured instance, send a read scoped API key as the Authorization header.
-
Verify the connection. Ask your client: “Use tares: what are you ingesting right now?” It should call
catalog_listand list your sources, including the Prometheus one. -
Ask about the service. Name the service and a time window:
Use tares: what happened to api-server in the last 15 minutes? Which metrics moved?
The agent calls read with the service as the selector and answers from the timeline.
- Check the source. Open the source in the console. Recent events shows one event per series per poll, and Fields shows labels such as
metric.serviceand the numericvalue. Details are on the Prometheus connector page.
What you get
- One answer that puts metric readings, alerts, logs and findings for the service in a single time-ordered timeline.
- Metric values stored as numbers, so you can ask about a rise or drop and also build a trigger on
max,avgorsumofvalue. - Metrics you chose by name or label, with no query language to write.
- A record of each question. In the console, Reads lists every read as it happens, tagged
client = mcp. - The same read from Claude Code, Codex, Cursor or any MCP client, so your team can use the tool it already has.
When something else fits
- If you want to watch a metric move yourself, open Explore in the console and pick the entity the series is keyed on.
- If you want to be woken when a metric crosses a threshold instead of asking after the fact, create a trigger on the
valuelabel. - If you want to ask without wiring up an external client, use Ask in the console, which has the same read tools.