MCPcopy
hub / github.com/opentrace/opentrace / resolve_calls

Function resolve_calls

agent/src/opentrace_agent/pipeline/resolving.py:100–144  ·  view source on GitHub ↗

Apply the 7-strategy resolution chain to all call references. Returns a list of CALLS GraphRelationship objects.

(
    call_infos: list[CallInfo],
    registries: Registries,
)

Source from the content-addressed store, hash-verified

98
99
100def resolve_calls(
101 call_infos: list[CallInfo],
102 registries: Registries,
103) -> list[GraphRelationship]:
104 """Apply the 7-strategy resolution chain to all call references.
105
106 Returns a list of CALLS GraphRelationship objects.
107 """
108 results: list[GraphRelationship] = []
109
110 for ci in call_infos:
111 seen: set[str] = set()
112 for name, receiver, kind in ci.calls:
113 dedup_key = f"{receiver or ''}:{name}"
114 if dedup_key in seen:
115 continue
116 if name == ci.caller_name and receiver is None:
117 continue
118
119 target_id, confidence = _resolve_single_call(
120 name=name,
121 receiver=receiver,
122 kind=kind,
123 caller_id=ci.caller_id,
124 file_id=ci.file_id,
125 caller_receiver_var=ci.receiver_var,
126 caller_receiver_type=ci.receiver_type,
127 caller_param_types=ci.param_types,
128 registries=registries,
129 )
130 if target_id is None:
131 continue
132
133 seen.add(dedup_key)
134 results.append(
135 GraphRelationship(
136 id=f"{ci.caller_id}->CALLS->{target_id}",
137 type="CALLS",
138 source_id=ci.caller_id,
139 target_id=target_id,
140 properties={"confidence": confidence},
141 )
142 )
143
144 return results
145
146
147def _resolve_single_call(

Callers 8

test_self_resolutionFunction · 0.90
test_dedup_callsFunction · 0.90
test_skip_recursive_callFunction · 0.90
resolvingFunction · 0.85

Calls 4

GraphRelationshipClass · 0.90
setFunction · 0.85
_resolve_single_callFunction · 0.85
addMethod · 0.45

Tested by 7

test_self_resolutionFunction · 0.72
test_dedup_callsFunction · 0.72
test_skip_recursive_callFunction · 0.72