Skip to main content
Glama
alilxxey

openobserve-community-mcp

search_values

Retrieve distinct field values from OpenObserve log streams within specified time ranges. Use filter queries to narrow results and analyze field data patterns.

Instructions

Get distinct field values for a stream over a time range. filter_query uses OpenObserve's _values filter syntax, e.g. kubernetes_pod_namespace=litellm. Simple SQL-like equality such as kubernetes_pod_namespace='litellm' is normalized automatically. Time values are Unix timestamps in microseconds. Tip: 1 hour = 3_600_000_000 us, 1 day = 86_400_000_000 us. In this tool, total means the number of field groups returned, not the total number of matching log records.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stream_nameYes
fieldsYes
start_timeYes
end_timeYes
sizeNo
offsetNo
filter_queryNo
keywordNo
regionsNo
timeoutNo
no_countNo
include_rawNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool definition for `search_values` in the MCP server, which orchestrates calling the client and formatting the result.
    @server.tool()
    def search_values(
        stream_name: str,
        fields: str,
        start_time: int,
        end_time: int,
        size: int = 100,
        offset: int = 0,
        filter_query: str | None = None,
        keyword: str | None = None,
        regions: str | None = None,
        timeout: int | None = None,
        no_count: bool = False,
        include_raw: bool = False,
    ) -> dict[str, Any]:
        """Get distinct field values for a stream over a time range. filter_query uses OpenObserve's _values filter syntax, e.g. kubernetes_pod_namespace=litellm. Simple SQL-like equality such as kubernetes_pod_namespace='litellm' is normalized automatically. Time values are Unix timestamps in microseconds. Tip: 1 hour = 3_600_000_000 us, 1 day = 86_400_000_000 us. In this tool, total means the number of field groups returned, not the total number of matching log records."""
        client = client_provider.get()
        raw = client.search_values(
            stream_name=stream_name,
            fields=fields,
            start_time=start_time,
            end_time=end_time,
            size=size,
            offset=offset,
            filter_query=filter_query,
            keyword=keyword,
            regions=regions,
            timeout=timeout,
            no_count=no_count,
        )
        return build_search_values_result(
            org_id=client.resolve_org_id(),
            stream_name=stream_name,
            fields=fields,
            raw=raw,
            include_raw=include_raw,
        )
  • The underlying API client method that performs the HTTP request to the OpenObserve `_values` endpoint.
    def search_values(
        self,
        *,
        stream_name: str,
        fields: str,
        start_time: int,
        end_time: int,
        offset: int = 0,
        size: int = 100,
        filter_query: str | None = None,
        keyword: str | None = None,
        regions: str | None = None,
        timeout: int | None = None,
        no_count: bool = False,
    ) -> Any:
        query: dict[str, str | int | float | bool] = {
            "fields": fields,
            "size": size,
            "from": offset,
            "start_time": start_time,
            "end_time": end_time,
            "no_count": no_count,
        }
        if filter_query:
            query["filter"] = _normalize_values_filter_query(filter_query)
        if keyword:
            query["keyword"] = keyword
        if regions:
            query["regions"] = regions
        if timeout is not None:
            query["timeout"] = timeout
    
        try:
            return self.request_json(
                "GET",
                self._org_path("/api/{org_id}/{stream_name}/_values", stream_name=stream_name),
                query=query,
            )
        except OpenObserveApiError as exc:
            if filter_query and exc.status_code == 500:
                raise OpenObserveApiError(
                    exc.status_code,
                    f"{exc} filter_query is passed directly to OpenObserve's _values filter parser "
                    "and may not match normal SQL WHERE syntax.",
                    body=exc.body,
                ) from exc
            raise
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds some context: it clarifies that 'total' refers to field groups, not log records, and mentions time format and normalization. However, it lacks details on permissions, rate limits, error handling, or the output structure, leaving gaps for a tool with 12 parameters.

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 appropriately sized and front-loaded, starting with the core purpose. Each sentence adds value: syntax examples, time conversions, and clarification of 'total'. There's minimal waste, though the tip on time conversions could be slightly condensed.

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?

Given the tool's complexity (12 parameters, no annotations) and the presence of an output schema, the description is moderately complete. It covers key parameters and behavioral aspects but misses details like auth needs or error cases. The output schema reduces the need to explain return values, but more context on usage and limitations would improve completeness.

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?

The description adds meaningful context beyond the input schema, which has 0% description coverage. It explains the 'filter_query' syntax with examples, clarifies time units, and defines 'total'. This compensates well for the schema's lack of descriptions, though it doesn't cover all 12 parameters (e.g., 'regions', 'timeout').

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?

The description clearly states the tool's purpose: 'Get distinct field values for a stream over a time range.' It specifies the verb ('Get'), resource ('distinct field values'), and scope ('for a stream over a time range'), making the function understandable. However, it doesn't explicitly differentiate from sibling tools like 'search_logs' or 'search_around' beyond the distinct-values focus.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions the tool's function but doesn't indicate scenarios where it's preferred over sibling tools like 'search_logs' or 'get_stream_schema', nor does it discuss prerequisites or exclusions. Usage is implied through parameter details but not explicitly stated.

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/alilxxey/openobserve-community-mcp'

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