Skip to main content
Glama

Run OpenSearch DSL query

search_dsl
Read-only

Run raw OpenSearch DSL queries against Malcolm indices to return matching hits and aggregations, with full control over query and aggregation bodies.

Instructions

Run a raw OpenSearch DSL query and return its hits plus aggregations.

    Use this for full DSL control over the query and aggregation bodies. When you
    only need a match count and not the documents, use count. For Malcolm's
    simpler field-filter syntax instead of raw DSL, use malcolm_search.
    Aggregations honor the time filter inside the DSL body, so there is no hidden
    default time window. Returns the raw OpenSearch _search response. A body
    OpenSearch rejects comes back as an error carrying OpenSearch's own reason,
    e.g. a parsing_exception naming the unknown query type. A reply from only
    some shards, or one that timed out, still arrives as success, so an
    "INCOMPLETE:" line above the JSON says so; treat its counts as a floor.

    Every input guard runs before any request leaves this server: malformed
    query_dsl, an index containing /, ? or .., and a terms, multi_terms,
    significant_terms, significant_text or composite aggregation (nested
    ones included) whose size is above 500 are refused as input errors
    rather than costing an upstream scan. That is the same per-level bucket
    limit malcolm_aggregate has; for more values than that, page with a
    composite aggregation's after_key. When the query is easier to
    say as an Arkime expression, compile it with arkime_build_query and hand
    the index and query_dsl it returns straight to this tool — serialise its
    query_dsl object to a JSON string first, which is what this parameter
    declares.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sizeNoMax hits to return; 0 for aggregation-only. Always overrides any "size" key inside query_dsl.
indexYesIndex or pattern to query, e.g. "arkime_sessions3-*". Accepts a wildcard; must contain no path metachars (/, ?, ..).
query_dslYesJSON string of a full DSL body, e.g. {"query": {...}, "aggs": {...}}. A bare query clause such as {"term": {...}} is wrapped as {"query": ...} for you; a body with "aggs", "size", "sort" or another search key but no "query" is sent as is (match_all).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.2.0
    • changedInput schema / properties / query_dsl / description
      Previous value: -"JSON string of a full DSL body, e.g. {\"query\": {...}, \"aggs\": {...}}. A bare query object with no \"query\" key is wrapped as {\"query\": ...} for you."New value: +"JSON string of a full DSL body, e.g. {\"query\": {...}, \"aggs\": {...}}. A bare query clause such as {\"term\": {...}} is wrapped as {\"query\": ...} for you; a body with \"aggs\", \"size\", \"sort\" or another search key but no \"query\" is sent as is (match_all)."
  2. Addedv0.3.2
  3. Removedv0.3.0
  4. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations declare readOnly/openWorld, and the description adds substantial context beyond them: aggregations honor the in-body time filter (no hidden default window), rejected bodies surface OpenSearch's own reason (e.g. parsing_exception), partial/timed-out shard replies arrive as success flagged by an 'INCOMPLETE:' line whose counts are a floor, and a list of pre-flight input guards (malformed DSL, path metachars, oversized terms/composite aggs >500) that fail locally rather than costing an upstream scan.

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?

Front-loaded with purpose before alternatives and edge-case detail, and organized into distinct paragraphs (routing, result semantics, guards, cross-tool handoff). It is long, but nearly every sentence carries behavioral information rather than filler.

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?

With an output schema present, the description needn't explain return values, yet it still covers error shapes, partial-result signaling, guard behavior and sibling routing. Nothing needed to invoke the tool correctly is missing.

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 schema already documents index, size and query_dsl semantics. The description's param-relevant notes (serialise query_dsl to a JSON string, size overriding any in-body size) largely restate what the schema declares, so it lands at the baseline rather than adding meaning beyond it.

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?

Opens with a specific verb+resource: 'Run a raw OpenSearch DSL query and return its hits plus aggregations.' It also explicitly distinguishes itself from siblings count and malcolm_search, so an agent can route correctly without opening any schema.

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?

Gives explicit when-to-use and when-not-to-use guidance: 'Use this for full DSL control... When you only need a match count... use count. For Malcolm's simpler field-filter syntax... use malcolm_search.' It even names arkime_build_query as a producer of inputs for this tool.

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