feat(hints): remove string hints — consolidate to hints_structured with reason field#223
Conversation
…th reason field - Remove redundant hints: list[str] field from all 5 MCP tool output models - Add reason: str to StructuredHint — explains why each hint was emitted - Add advisories: list[str] to all output models — pure informational text with no tool call - Eliminate dual-emission maintenance burden and parity test - Preserve all currently emitted advisory information — string-only hints move to advisories, tool-call hints gain reason Changes: - mcp_hints.py: Added reason to _StructuredHint, removed TPL_* template constants, changed generate_hints return type to (structured, advisories), added finalize_advisories() - mcp_v2.py: Added reason to StructuredHint, added advisories field, removed hints field from all output models - server.py: Updated tool descriptions to reference hints_structured and advisories - tests/test_mcp_hints.py: Migrated 80+ tests, removed template-based tests, added 7 new tests for reason and advisories - docs/AGENT-GUIDE.md: Updated documentation to reflect new field structure Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Code ReviewThe architecture is right and the code reduction is excellent. A few issues to address: Bug:
|
- Fix bug: find success hints now emit when limit=None (was missing) - Add comment explaining intentional removal of regex fallback in neighbors hints - Shorten unresolved call sites advisory to stay under 200 char cap - Add comment documenting expected template format for split-based parsing Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Follow-up ReviewAll four items from the previous review are addressed:
LGTM — ready to merge. 🤖 Generated with Claude Code |
Summary
Removes the redundant
hints: list[str]field from all 5 MCP tool output models and replaces it with a cleaner structure:reason: str = ""field toStructuredHint— explains why each hint was emittedadvisories: list[str]field to all output models — pure informational text with no tool callgenerate_hintsreturn type fromtuple[list[str], list[_StructuredHint]]totuple[list[_StructuredHint], list[str]]TPL_*) and string-only helper functionsChanges
mcp_hints.py
reason: str = ""to_StructuredHintNamedTupleMCP_HINTS_FIELD_DESCRIPTIONconstant and allTPL_*string template constantsfinalize_hint_listfunction and string-only helpersgenerate_hintsreturn type to(structured hints, advisories)finalize_advisories()function for deduping advisory stringsmcp_v2.py
reason: str = ""to publicStructuredHintmodeladvisories: list[str]field to all 5 output modelshints: list[str]field from all output models_to_structured_hints()to forwardreasonfield(raw_struct, raw_advisories)instead of(str_hints, raw_struct)server.py
hints_structured(tool call suggestions with reason) andadvisories(informational notes)tests/test_mcp_hints.py
out.hintstoout.advisoriesorout.hints_structured[*].reason_structural_neighbors_hintshelper functiondocs/AGENT-GUIDE.md
hintslist referencesTest plan
Definition of Done
hints: list[str]field absent from all five output modelsadvisories: list[str]field present on all five output modelsreason: strfield present onStructuredHintand_StructuredHintgenerate_hintsreturnstuple[list[_StructuredHint], list[str]]MCP_HINTS_FIELD_DESCRIPTION, allTPL_*constants,finalize_hint_listremovedargswithout concrete tool callserver.pytool descriptions referencehints_structuredandadvisories🤖 Generated with Claude Code