Conversation
…l results
List-shaped tools default to limit=20 and used to return only `items`+`total`.
LLMs frequently skipped the implicit `len < total` check and presented the
first page as the full picture (the most common "the LLM only saw 20 incidents"
report).
Add `truncated:true` + a human-readable `hint` ("Returned 20 of 444 total. To
see more: raise `limit` (max 100), narrow `since`/`until`, or add filters")
when the result is actually truncated. No-op on full results so happy-path
output stays clean.
Also refresh the `limit` parameter description on incidents/alerts/changes to
mention the new fields up front, so the LLM is primed before the call.
Wired into: query_incidents, query_alerts, query_changes, query_channels,
query_escalation_rules, query_members, query_teams, query_fields,
list_status_changes, list_similar_incidents.
Verified end-to-end through Safari → runner → mcp-server: when asked to
"查询最近一周的所有告警", the LLM (a) proactively raised `limit` to 100 from
the new description, (b) read `truncated:true`/`total:444` and split the
window into multiple sub-queries on its own, (c) reported "100/444 分析样本"
to the user instead of silently presenting page 1 as the whole truth.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
limit=20but only returneditems+total. The LLM frequently skipped the implicitlen(items) < totalcheck and presented page 1 as the full picture.truncated:true+ a human-readablehint("Returned 20 of 444 total. To see more: raise limit (max 100), narrow since/until, or add filters") onto the response only when actually truncated, so the LLM cannot miss it. Happy path stays clean.limitparameter description on the three time-window query tools to call out the new fields up front, priming the LLM before the call.Wired into 10 list-shaped tools:
query_incidents,query_alerts,query_changes,query_channels,query_escalation_rules,query_members,query_teams,query_fields,list_status_changes,list_similar_incidents.Test plan
End-to-end through Safari → runner → mcp-server:
truncated:true+hint(verifiedtotal:444 / count:3)truncated/hintfieldlimit:100(from refreshed description), recognized truncation, attempted time-window splitting, and reported "100/444" to the usergo test ./...,go vet ./...,gofmtclean🤖 Generated with Claude Code