MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _infer_tool_name

Function _infer_tool_name

uncommon_route/composition.py:603–620  ·  view source on GitHub ↗
(messages: list[dict[str, Any]], idx: int, tool_call_id: str)

Source from the content-addressed store, hash-verified

601
602
603def _infer_tool_name(messages: list[dict[str, Any]], idx: int, tool_call_id: str) -> str:
604 if not tool_call_id:
605 return ""
606 for prev in reversed(messages[:idx]):
607 if not isinstance(prev, dict):
608 continue
609 tool_calls = prev.get("tool_calls") or []
610 if not isinstance(tool_calls, list):
611 continue
612 for call in tool_calls:
613 if not isinstance(call, dict):
614 continue
615 if call.get("id") != tool_call_id:
616 continue
617 fn = call.get("function") or {}
618 name = fn.get("name", "")
619 return str(name)
620 return ""
621
622
623def _build_artifact_stub(text: str, record: Any, policy: CompositionPolicy) -> str:

Callers 1

_compose_deterministicFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected