Skip to main content
Glama
alilxxey

openobserve-community-mcp

search_around

Retrieve log entries surrounding a specific timestamp in OpenObserve logs to analyze context and patterns.

Instructions

Fetch records around a specific log entry. key must be the target record's _timestamp value in microseconds. output_format can be 'records' or 'columns' for a more token-efficient table shape. record_profile can be 'generic' or 'kubernetes_compact'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stream_nameYes
keyYes
sizeNo
regionsNo
timeoutNo
output_formatNorecords
record_profileNogeneric
include_rawNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core client method that performs the API request to fetch records around a specific log entry.
    def search_around(
        self,
        *,
        stream_name: str,
        key: int,
        size: int = 20,
        regions: str | None = None,
        timeout: int | None = None,
    ) -> Any:
        query: dict[str, str | int | float | bool] = {
            "key": key,
            "size": size,
        }
        if regions:
            query["regions"] = regions
        if timeout is not None:
            query["timeout"] = timeout
    
        return self.request_json(
            "GET",
            self._org_path("/api/{org_id}/{stream_name}/_around", stream_name=stream_name),
            query=query,
        )
  • The MCP tool registration and handler that interfaces with the client and formats the response.
    @server.tool()
    def search_around(
        stream_name: str,
        key: int,
        size: int = 20,
        regions: str | None = None,
        timeout: int | None = None,
        output_format: str = "records",
        record_profile: str = "generic",
        include_raw: bool = False,
    ) -> dict[str, Any]:
        """Fetch records around a specific log entry. key must be the target record's _timestamp value in microseconds. output_format can be 'records' or 'columns' for a more token-efficient table shape. record_profile can be 'generic' or 'kubernetes_compact'."""
        client = client_provider.get()
        raw = client.search_around(
            stream_name=stream_name,
            key=key,
            size=size,
            regions=regions,
            timeout=timeout,
        )
        return build_search_around_result(
            org_id=client.resolve_org_id(),
            stream_name=stream_name,
            size=size,
  • Helper function that processes and formats the raw API results into a response compatible with MCP tool outputs.
    def build_search_around_result(
        *,
        org_id: str,
        stream_name: str,
        size: int,
        raw: Any,
        output_format: str,
        record_profile: str,
        include_raw: bool,
    ) -> dict[str, Any]:
        hits = raw.get("hits", []) if isinstance(raw, dict) else []
        records = [_apply_record_profile(summarize_search_record(hit), record_profile=record_profile) for hit in hits if isinstance(hit, dict)]
        result: dict[str, Any] = {
            "org_id": org_id,
            "stream_name": stream_name,
            "requested_size": size,
            "hit_count": len(hits),
            "output_format": _normalize_output_format(output_format),
            "record_profile": _normalize_record_profile(record_profile),
        }
        _attach_record_payload(result, records, output_format=output_format)
        return maybe_include_raw(result, raw, include_raw)
    
    
    def build_search_values_result(
        *,
        org_id: str,
        stream_name: str,
        fields: str,
        raw: Any,
        include_raw: bool,
    ) -> dict[str, Any]:
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions some output format options and record profiles but doesn't explain what 'around' means operationally (temporal window? record count?), doesn't mention performance characteristics, error conditions, or what happens when the key doesn't exist. For a search tool with 8 parameters, this is insufficient 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?

The description is appropriately concise with three sentences that each add value. It's front-loaded with the core purpose, though it could be slightly more structured by grouping related parameter explanations together.

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 (8 parameters, search operation) and the presence of an output schema, the description provides basic operational context but lacks important details. It explains some parameter semantics but leaves most parameters unexplained, doesn't clarify the search behavior ('around' what exactly?), and provides no usage guidance relative to sibling tools.

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 0% schema description coverage, the description adds significant value by explaining that 'key must be the target record's _timestamp value in microseconds' and clarifying the semantics of 'output_format' and 'record_profile' options. However, it doesn't explain the purpose of 'stream_name', 'size', 'regions', 'timeout', or 'include_raw' parameters, leaving 5 of 8 parameters without semantic explanation.

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 verb 'fetch' and resource 'records around a specific log entry', making the purpose understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'search_logs' or 'search_values', which appear to be related search operations.

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 like 'search_logs' or 'search_values'. It mentions parameter options but gives no context about appropriate use cases or prerequisites for this specific search operation.

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