Skip to main content
Glama
Cloady

Cloady

Official
by Cloady

Query App Logs

queryAppLogs
Read-only

Runs LogQL queries over an app's seven-day log history to return log lines or metric series for troubleshooting and monitoring.

Instructions

Runs a LogQL query over the app's own logs, kept for seven days, and returns Loki's answer unchanged: lines for a log query, series for a metric query. Streams: {container="<service>"} is each compose service's own output, with pod and a detected_level (error, critical, fatal, warn, info, debug, trace or unknown) to filter on as | detected_level=~"error|critical|fatal"; {container="_events"} holds the Kubernetes events about the app's objects as JSON (kind, name, reason, type, msg, count); {container="_access", service="<service>"} is the ingress access log of the service the app's address routes to, as Traefik's JSON (RequestMethod, RequestPath, DownstreamStatus, Duration in nanoseconds, request_User-Agent), with route, method and status as fields; and {container="_rum", kind="pageview"} with kinds vital, error, net, signal, custom and session holds browser monitoring, with page, session, device, browser, os and country as fields. Session recordings are kept apart: getBrowserSessionReplay reads them, with the developer role. A query the store refuses comes back with the store's own status and error. The path is the store's own, so a Grafana data source can point here too.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "workspaceSlug": "<workspaceSlug>",
      "appSlug": "<appSlug>",
      "query": "<query>"
    },
    "name": "queryAppLogs"
  }
}

Input Schema

NameRequiredDescriptionDefault
endNoEnd of the range; now when absent
envNo
stepNoSeconds between points of a metric query, or a duration such as `1m`
limitNoMost lines to return for a log query, 100 when absent
queryYesA LogQL query: a log query returns lines, a metric query such as `sum by (detected_level) (count_over_time({container="web"} [5m]))` returns series
startNoStart of the range, as Unix seconds, Unix nanoseconds or RFC 3339; an hour before `end` when absent
regionNo
appSlugYes
directionNo`backward`, the default, returns the newest lines first
workspaceSlugYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.18.0

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well past the read-only/open-world annotations: it discloses the seven-day retention window, that results are returned as raw Loki payloads (lines vs series), the concrete stream and field layout of each source, and the failure behavior — a rejected query returns the store's status plus an `error` field. That error semantics detail is exactly the kind of thing annotations cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose, retention and return contract are front-loaded before the stream catalog, which is the right order. The catalog itself is a dense semicolon-chained sentence that is hard to parse on first read, and the closing note about pointing a Grafana data source at the path is marginal, but nearly every element carries usable signal.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 10-parameter query tool with no output schema, the description covers the two things an agent most needs: what shape the result takes and how failures surface. Remaining gaps are about environment/region scoping and how the app's own logs relate to service-level log tools, not about the call itself.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 60% schema coverage, the description supplies the meaning the schema lacks for `query`: label-filter syntax (`| detected_level=~"error|critical|fatal"`) and the queryable field names per stream (`route`, `method`, `status`, `RequestMethod`, `DownstreamStatus`, `Duration` in ns). It says nothing about `env`, `region`, or how `workspaceSlug`/`appSlug` scope which logs are visible, so a couple of undocumented params remain dark.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Uses a specific verb and resource ('Runs a LogQL query over the app's own logs') and immediately bounds scope with the seven-day retention and the unchanged-Loki-result contract. It also distinguishes itself from siblings by naming the stream inventory available here and pointing session recordings at getBrowserSessionReplay.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete routing guidance for the one confusable case ('Session recordings are kept apart: getBrowserSessionReplay reads them, with the developer role') and effectively tells the agent which stream to query for which data. It does not, however, explicitly contrast with readServiceLogs, streamDeployLogs or streamAppStatus, which an agent could easily mistake for log access.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools