feat(hints): add machine-parseable hints_structured field to all MCP outputs#209
Conversation
Code ReviewOverall this is well-executed — backward-compatible, clean separation via Issues1. resolve/none branch appends extra The 2. resolve/many structured hint has placeholder empty args ( struct_pairs.append(_StructuredHint(
"resolve", {"identifier": "", "hint_kind": ""}, False, PRIORITY_META,
))The 3. find page-full structured hint has empty struct_pairs.append(_StructuredHint(
"find", {"kind": kind, "filter": {}, "limit": int(lim)}, False, PRIORITY_META,
))Since Minor observations
Test coverageExcellent. 36 new tests covering every variant, parity invariant, cap/dedup, round-trip integration, and prose-only VerdictThe resolve/none extra search hint (#1) is the most notable issue — worth fixing before merge to prevent a subtle parity violation. The other two are lower-priority polish. 🤖 Generated with Claude Code |
Re-review: All issues addressedAll three items from the prior review are fixed:
LGTM. Ship it. 🤖 Generated with Claude Code |
Add StructuredHint model (tool, args, actionable) alongside existing hints: list[str] on all five MCP output models. Refactor generate_hints to return (string_hints, structured_hints) tuple. Map every existing string-hint trigger to a structured equivalent. Batch-placeholder hints (N2-N7) populate args.ids from results. Prose-only hints use actionable=False. Full test coverage (36 named tests), parity invariant enforced, round-trip integration test passes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ty tests
- resolve/many: populate identifier and hint_kind from payload instead of empty strings
- find/page-full: include actual filter dict instead of empty {}
- parity test: add resolve/none route and client cases to verify no extra search hint
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
247f560 to
8078578
Compare
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
PR-1 (#209) has been merged, implementing machine-parseable hints_structured field on all MCP outputs. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…utput (#212) After HINTS-STRUCTURED landed (#209), generate_hints returns (list[str], list[_StructuredHint]). Update the proposal to account for the dual-list pattern: structured hint mapping table, structured test rows, and updated implementation notes. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
StructuredHintPydantic model (tool,args,actionable) andhints_structured: list[StructuredHint]field on all five MCP output models (SearchOutput,FindOutput,DescribeOutput,NeighborsOutput,ResolveOutput)generate_hintsto returntuple[list[str], list[_StructuredHint]]— string hints remain backward-compatible, structured hints are additiveargs.idsfrom results; prose-only hints useactionable=Falsehints_structured; propose status lockedScope
Implements PR-1 from
plans/PLAN-HINTS-STRUCTURED.md.Proposal:
propose/HINTS-STRUCTURED-PROPOSE.mdSentinel checks
Validation
Key design decisions
hints: list[str]unchanged;hints_structuredis additivegenerate_hintsfunction returning both string and structured hints from unified trigger logic_StructuredHintNamedTuple inmcp_hints.pyavoids circular import withmcp_v2.py; PydanticStructuredHintconverts from it at call sites🤖 Generated with Claude Code