MCP builder tools return wrong results without an error: `min`/`max` of a DateTime is 0, and unknown options such as `having` are silently ignored
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- clickhouse, typescript
Línea de trabajo
Start with packages/common-utils/src/core/renderChartConfig.ts around lines 540–543 and packages/api/src/mcp/tools/query/table.ts around line 32; compare the generated aggregate SQL and how the input schema handles unknown keys. Reproduce both cases using the SQL example in the issue and a clickstack_table call with having. Done means DateTime min/max return timestamps and unsupported options produce a validation error or are applied as specified.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Two cases where clickstack_table / clickstack_timeseries return a plausible-looking answer that is wrong, with no error or warning. Agents can't tell, so they build conclusions on them.
min/maxon a DateTime column return 0. Every non-count aggregate wraps its value intoFloat64OrDefault(toString(expr))(packages/common-utils/src/core/renderChartConfig.ts:540-543). ForDate/DateTime/DateTime64,toString()gives'2026-11-04 08:00:00.000000000', which doesn't parse as a float, so every value becomes 0 andmax(Timestamp)is 0.- Unknown options are dropped. The tool input schemas are plain
z.object(...)(e.g.tableSchemainpackages/api/src/mcp/tools/query/table.ts:32), so zod strips keys it doesn't know.having: "lines > 5"is accepted, the SQL has noHAVING, and rows with 1 come back. Agents tryhavingbecause dashboard tiles support it (packages/api/src/mcp/tools/dashboards/schemas.ts:839).
Environment
HyperDX 2-nightly image (late Oct 2026) with ClickHouse 26.10.3. Code references checked on main at d08b2fa7 (2026-11-03, 2.43.1).
Steps to reproduce
clickstack_tableon a log or trace source,select: [{aggFn: "min", valueExpression: "Timestamp", alias: "first_seen"}, {aggFn: "max", valueExpression: "Timestamp", alias: "last_seen"}], any time range with data.- Result:
first_seen: 0, last_seen: 0. The SQL insystem.query_logismax(toFloat64OrDefault(toString(Timestamp))).
The cast alone, on any ClickHouse:
WITH arrayJoin([toDateTime64('2026-11-04 07:59:01.123', 9), toDateTime64('2026-11-04 08:00:00', 9)]) AS Timestamp
SELECT max(toFloat64OrDefault(toString(Timestamp))) AS rendered, max(Timestamp) AS expected
-- rendered = 0, expected = 2026-11-04 08:00:00.000000000
clickstack_tablewithgroupByandhaving: "count > 5": no validation error, the generated SQL has noHAVING, and groups with count 1 are returned.
Expected vs actual
| Expected | Actual | |
|---|---|---|
max(Timestamp) |
the latest timestamp (or a clear error) | 0 |
unknown option having |
a validation error naming the valid options, or having applied |
silently ignored |
Impact
In 4 agent investigations on production-size data (about 170 MCP calls), 3 asked "first seen / last seen" questions and got 0 back, and 2 used having and got unfiltered results (one call returned 1,044 groups, which then hit response trimming, see #3542).
Proposed fix
min,maxandanydon't need a Float64 value. Pass the expression through uncast for them, or convert dates numerically (e.g.toUnixTimestamp64Milli) instead of viatoString. The aggregate already handles numbers and numeric strings today, so a type check (date-like → no cast) keeps that behaviour.- Make the MCP tool input schemas
.strict(), so an unknown key returns a validation error listing the accepted options. Addinghavingandlimittoclickstack_tableitself, as tiles already support, is part of #3542.
Related
- #3542: MCP response trimming, and
clickstack_tablehas nolimit,havingor default order - #3499:
valueExpressionignored on metric selects - #2311 / #3237:
count_distincton metric tiles
- Lenguaje dominante
- TypeScript
- Estrellas
- 10.1k
- Forks
- 527
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 186
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ClickHouse/ClickStack
-
external
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ClickHouse/ClickStack#3761 ·
Los mantenedores suelen responder en 1 día
-
Metric chart with aggFn increase and a multi-column group-by fails: toString() gets several argumentsPosiblemente ocupada @CG-5228 la tomó hace 26 días. Abiertoexternal
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ClickHouse/ClickStack#3477 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Slack notifications for inline alerts fail when the chart-explorer link passes Slack's 3000-character block limitPosiblemente ocupada @Tyagiquamar la tomó hace 27 días. Abiertoalerting bug external
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ClickHouse/ClickStack#3452 ·
Los mantenedores suelen responder en 1 día
-
check-alerts worker: 13 error spans (mongodb.create, NamespaceExists) every minute because mongoose autoCreate is still onQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug external Needs Feedback
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ClickHouse/ClickStack#3308 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
count_distinct aggFn on metric tiles ignores valueExpression, always counts distinct metric ValuesPosiblemente ocupada @Harshul1484 la tomó hace 54 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ClickHouse/ClickStack#2311 ·
Los mantenedores suelen responder en 1 día
Todos los issues de ClickHouse/ClickStack
Issues similares
-
Add: GTrekkerAbiertocheck:passed streams:add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
area: ui Bug Payload OSS
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
payloadcms/payload#19839 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
fix(auth): add the email OTP verification step to Pollar loginPosiblemente ocupada @akansnoro la tomó hoy. AbiertoStellar Wave
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
safetrustcr/dApp-SafeTrust#584 · 10 comentarios ·
Los mantenedores suelen responder en 1 día
-
The manager preset saves launch definitions without the required file and digest pairPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día