Skip to content

Mirror HDX-4376 implicit→body fallback in MCP query tools and alert templates #2355

Open

Description

@alex-fedotyev

Follow-up to #2354 (HDX-4376), which added a bare-text Lucene search fallback from `implicitColumnExpression` to `bodyExpression` on log sources.

The UI flow is fixed. For consistency, the same fallback needs to be threaded through backend paths that build their own `ChartConfigWithDateRange` from a source:

  • `packages/api/src/mcp/tools/query/helpers.ts` (search MCP tool + raw-SQL tile macros)
  • `packages/api/src/mcp/tools/query/runEventPatterns.ts` (event-patterns sample + count configs)
  • `packages/api/src/mcp/tools/query/eventDeltas.ts` (event-deltas sample config)
  • `packages/api/src/tasks/checkAlerts/index.ts` (`computeAliasWithClauses`)
  • `packages/api/src/tasks/checkAlerts/template.ts` (sample-log query in alert template rendering)

For each: when the source is a log source, pull `source.bodyExpression` alongside `source.implicitColumnExpression` and pass both to the chart config. Trace sources stay unchanged.

The schema change in #2354 already added `bodyExpression` to `_ChartConfigSchema` and `RawSqlChartConfigSchema`, so this is purely callsite-level plumbing.

No test coverage gap to backfill: `CustomSchemaSQLSerializerV2` itself is tested in common-utils. The callsites just need to thread the field through.

Effort: ~30 minutes, single-package (api) change.

Activity

  1. ntmspavan commented on Nov 16, 2026

    @ntmspavan

    I can take this. I’ll pass the log source bodyExpression through the MCP and alert query configs listed above, preserve explicit implicitColumnExpression precedence and trace-source behavior, and add regression tests for the affected paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions