Skip to content

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

@alex-fedotyev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions