Skip to main content
Glama
techskies11

datadog-mcp

by techskies11

count_unique_values

Read-onlyIdempotent

Count unique values of a field in Datadog logs to find distinct sessions, users, or IPs without fetching all logs.

Instructions

Count UNIQUE values of a field (distinct count / cardinality).

PERFECT for counting unique sessions, users, IPs, etc. Much more efficient than fetching all logs with search_logs and counting distinct values client-side.

Use this when:

  • "How many unique users/sessions?"

  • "Count distinct values"

  • "How many different X?"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldYesField to count unique values of (e.g. "@session_id", "@user.id", "host")
queryYesSearch query using Datadog log search syntax
indexesNoOptional list of index names to search
to_timeYesEnd time - same accepted formats as from_time
from_timeYesStart time - ISO 8601, relative date math (e.g. "now-1h"), or a millisecond timestamp

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, covering the safety profile. The description adds a behavioral claim about efficiency ('Much more efficient than fetching all logs with search_logs'), which is useful context beyond the annotations. It does not contradict any annotation.

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

Conciseness5/5

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

The description is compact and front-loaded: the core definition appears in the first line, followed by concise use-case bullets. Every sentence contributes to understanding, with no redundant text.

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 full schema coverage, annotations, and an existing output schema, the description fully covers purpose, usage, and the main alternative. It is sufficient for an agent to invoke the tool correctly.

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 the parameters are fully documented. The description reinforces the role of 'field' by giving examples ('@session_id', '@user.id') but adds no new syntax or format details. Baseline 3 is appropriate.

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 opens with a specific and unambiguous definition: 'Count UNIQUE values of a field (distinct count / cardinality).' This clearly identifies the operation and resource. It also differentiates from sibling tools like search_logs by positioning itself as the efficient option for cardinality queries.

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

Usage Guidelines5/5

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

The description provides an explicit 'Use this when:' section with concrete question patterns (e.g., 'How many unique users/sessions?', 'Count distinct values'). It also names search_logs as the alternative to avoid, making the choice between tools clear.

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/techskies11/datadog-mcp'

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