Skip to main content
Glama
mackerelio-labs

Mackerel MCP Server

Official

List Database Query Statistics

list_db_query_stats
Read-only

Retrieve database query statistics from Mackerel to analyze slow or high-frequency queries and investigate performance issues.

Instructions

Retrieve database query statistics from Mackerel.

šŸ” USE THIS TOOL WHEN USERS:

  • Analyze slow database queries

  • Identify high-frequency queries

  • Investigate database performance issues

  • Monitor query execution patterns

Filter by environment and version

list_db_query_stats(
  serviceName="my-service",
  from=1700000000,
  to=1700001800,
  environment="production",
  version="v1.2.3"
)

Search for specific queries

list_db_query_stats(
  serviceName="my-service",
  from=1700000000,
  to=1700001800,
  query="SELECT * FROM users"
)

Pagination

list_db_query_stats(
  serviceName="my-service",
  from=1700000000,
  to=1700001800,
  page=10,
  perPage=50
)

Input Schema

NameRequiredDescriptionDefault
toYesEnd time for retrieving statistics (Unix epoch seconds). The range between `from` is limited to 30 minutes
fromYesStart time for retrieving statistics (Unix epoch seconds). The range between `to` is limited to 30 minutes
pageNoPage number (starting from 1). Default is 1
queryNoFilter by SQL query (partial match). Corresponds to `db.query.text` or `db.statement` in OpenTelemetry semantic conventions. db.query.text is preferred
perPageNoNumber of items per page (1-100). Default is 20
versionNoVersion. Corresponds to `service.version` in OpenTelemetry semantic conventions
environmentNoEnvironment name. Corresponds to `deployment.environment` or `deployment.environment.name` in OpenTelemetry semantic conventions
orderColumnNoSort column. One of `SUM` (total latency), `AVERAGE` (average latency), `P95` (95th percentile latency), or `EXECUTION_COUNT` (execution count). Default is `P95`.
serviceNameYesService name. Corresponds to `service.name` in OpenTelemetry semantic conventions.
orderDirectionNoSort order. Either `ASC` (ascending) or `DESC` (descending). Default is `DESC`
serviceNamespaceNoService namespace. Corresponds to `service.namespace` in OpenTelemetry semantic conventions

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.10.0

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, so the safety profile is covered. The description adds usage scenarios but omits notable behavior: the 30-minute from/to range constraint (only in schema), default sort column P95, and the shape of returned statistics. Useful but not rich behavioral context.

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 statement and usage bullets are front-loaded and easy to scan. The four examples are somewhat verbose for a CRUD-list tool, but each demonstrates a distinct parameter combination, so little is pure waste.

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

Completeness3/5

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

With 11 parameters, no output schema, and no description of what the returned statistics contain (latency aggregates, query text, counts), the definition leaves the return payload undocumented. When/how is covered, but an agent cannot anticipate the response shape.

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

Parameters3/5

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

Schema description coverage is 100%, so every parameter including enums (orderColumn, orderDirection) and defaults is already documented. The examples illustrate a few parameter combinations (pagination, filtering) but add no semantics beyond the schema; baseline 3 applies.

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

Purpose4/5

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

States a specific verb and resource ('Retrieve database query statistics from Mackerel'), which is unambiguous. It does not differentiate itself from siblings like list_http_server_stats or list_traces, so an agent must infer that this covers DB query stats specifically.

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?

The 'USE THIS TOOL WHEN USERS' bullets give clear usage contexts (slow queries, high-frequency queries, performance investigation). However, no exclusion criteria or named alternatives are given, so when-not-to-use is left implicit.

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