MCPcopy Index your code
hub / github.com/tirth8205/code-review-graph / generate_hints

Function generate_hints

code_review_graph/hints.py:240–275  ·  view source on GitHub ↗

Build context-aware hints for a tool response. Returns:: { "next_steps": [{"tool": ..., "suggestion": ...}, ...], "related": [...], "warnings": [...], } At most ``_MAX_PER_CATEGORY`` items per list. Tools already called in this sess

(
    tool_name: str,
    result: dict[str, Any],
    session: SessionState,
)

Source from the content-addressed store, hash-verified

238
239
240def generate_hints(
241 tool_name: str,
242 result: dict[str, Any],
243 session: SessionState,
244) -> dict[str, Any]:
245 """Build context-aware hints for a tool response.
246
247 Returns::
248
249 {
250 "next_steps": [{"tool": ..., "suggestion": ...}, ...],
251 "related": [...],
252 "warnings": [...],
253 }
254
255 At most ``_MAX_PER_CATEGORY`` items per list. Tools already called
256 in this session are suppressed from ``next_steps``.
257 """
258 # Update session state.
259 session.record_tool_call(tool_name)
260 session.inferred_intent = infer_intent(session)
261
262 next_steps = _build_next_steps(tool_name, session)
263 warnings = _extract_warnings(result)
264 # Build related BEFORE tracking, so that the current result's files
265 # are not yet in files_touched and can appear as suggestions.
266 related = _build_related(tool_name, result, session)
267
268 # Collect files/nodes from result for session tracking.
269 _track_result(result, session)
270
271 return {
272 "next_steps": next_steps[:_MAX_PER_CATEGORY],
273 "related": related[:_MAX_PER_CATEGORY],
274 "warnings": warnings[:_MAX_PER_CATEGORY],
275 }
276
277
278# ---------------------------------------------------------------------------

Calls 6

infer_intentFunction · 0.85
_build_next_stepsFunction · 0.85
_extract_warningsFunction · 0.85
_build_relatedFunction · 0.85
_track_resultFunction · 0.85
record_tool_callMethod · 0.80