Skip to main content
Glama
YawLabs

@yawlabs/aws-mcp

Official
by YawLabs

aws_metrics_query

Read-onlyIdempotent

Query multiple AWS CloudWatch metrics and metric math expressions in a single call using GetMetricData. Specify time ranges with ISO 8601 or relative shorthand, and get auto-scaled period to stay within data limits.

Instructions

Query CloudWatch metrics via GetMetricData (the modern multi-metric / expression-capable API, not the legacy get-metric-statistics). Pass queries as a flat array of {id, namespace, metricName, dimensions?, statistic?, period?, expression?, label?}; the tool shapes them into MetricDataQueries for you. startTime/endTime accept ISO 8601 or relative shorthand ('15m', '1h', '1d', '1w'); endTime defaults to 'now'. Period is auto-picked from the time range when omitted (60s for <=3h, 300s for <=24h, 900s for <=15d, 3600s otherwise) to stay under CloudWatch's ~100,800-datapoint response cap. Returns {series: [{id, label?, timestamps, values, period?, statusCode?}], messages?, periodSeconds, profile, region, nextToken, hasMore}. Each series' period is the effective granularity for that query (its explicit period, or the auto-pick it inherited); it is omitted for an expression query that didn't set one. The top-level periodSeconds is always the auto-pick. When CloudWatch truncates a large response, hasMore is true and nextToken carries the resume cursor -- call again with nextToken set to fetch the next page (rare for typical agent queries that stay within the per-request cap). Use for 'show me the CPU on this instance for the last hour', 'sum lambda invocations across these 3 functions', or expression-based 'p99 latency divided by average latency' lookups.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queriesYes1-100 queries. Each is either a metric-stat (namespace + metricName) or an expression.
startTimeNoISO 8601 timestamp or relative shorthand ('15m', '1h', '1d', '1w'). Default '1h' (one hour ago).
endTimeNoISO 8601 timestamp or relative shorthand. Default 'now'.
scanByNoSort order for returned datapoints. Default 'TimestampDescending' (matches CloudWatch's default).
maxDataPointsNoTarget datapoint count. CloudWatch does not truncate to the first N points -- it widens (coarsens) the period server-side so the series aggregates down to fit this many points. CloudWatch's own ceiling is ~100,800; lower this to make CloudWatch return a coarser, smaller series. Forwarded as CloudWatch's MaxDatapoints (single 'p') field; the camelCase schema name follows this server's convention.
nextTokenNoResume cursor from a previous call's `nextToken`. Omit for the first page. Forwarded as CloudWatch's NextToken; only meaningful when a prior call returned `hasMore: true`.
profileNoOverride session profile for this call.
regionNoOverride session region for this call.
timeoutMsNoTimeout in milliseconds. Default 60000 (60s).
Behavior5/5

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

The description goes well beyond the annotations (readOnlyHint, idempotentHint) to explain key behaviors: auto-pick period logic, pagination via nextToken/hasMore, response structure, expression vs metric-stat distinction, and how malformed inputs cause downstream errors. This gives the agent a thorough understanding of the tool's behavior.

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?

The description is fairly long but well-structured and front-loaded with the main purpose. Each part adds value, though there is slight repetition of period auto-pick details. Overall, it efficiently covers all needed aspects without unnecessary fluff.

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

Completeness5/5

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

Given the tool's complexity (9 parameters, no output schema), the description is remarkably complete. It explains the response format (series with timestamps/values), pagination, period semantics, and error behavior. Without an output schema, it compensates by describing return fields. Only minor detail like error conditions for missing required fields is omitted, but schema covers that.

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

Parameters5/5

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

Schema description coverage is 100%, so baseline is 3, but the description adds substantial value beyond schema. It explains how to structure queries (flat array of objects), clarifies startTime/endTime shorthand ('15m', '1h'), details auto-pick period rules, describes maxDataPoints server-side behavior, and explains nextToken usage. This enriches parameter understanding significantly.

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?

The description clearly states it queries CloudWatch metrics via GetMetricData, distinguishing it from the legacy get-metric-statistics API. It specifies the resource (CloudWatch metrics) and the action (query), and gives concrete examples like 'show me the CPU on this instance for the last hour'. This differentiates it from sibling tools that handle other AWS actions like aws_resource_list or aws_logs_tail.

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 description provides clear guidance on when to use this tool, explicitly contrasting with the legacy API and giving example use cases. It does not explicitly state when not to use it, but the sibling tools cover different AWS operations, so context suffices. The examples (CPU, Lambda invocations, expressions) illustrate appropriate scenarios.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/YawLabs/aws-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server