(
toolArgs: ToolArgs,
)
| 159 | const adaptor = getAdaptor(); |
| 160 | |
| 161 | const execute = async ( |
| 162 | toolArgs: ToolArgs, |
| 163 | ): Promise<CombinedCallToolResponse> => { |
| 164 | const callId = ++callIdRef.current; |
| 165 | setCallToolState({ status: "pending", data: undefined, error: undefined }); |
| 166 | |
| 167 | try { |
| 168 | const data = await adaptor.callTool<ToolArgs, CombinedCallToolResponse>( |
| 169 | name, |
| 170 | toolArgs, |
| 171 | ); |
| 172 | if (callId === callIdRef.current) { |
| 173 | setCallToolState({ status: "success", data, error: undefined }); |
| 174 | } |
| 175 | |
| 176 | return data; |
| 177 | } catch (error) { |
| 178 | if (callId === callIdRef.current) { |
| 179 | setCallToolState({ status: "error", data: undefined, error }); |
| 180 | } |
| 181 | throw error; |
| 182 | } |
| 183 | }; |
| 184 | |
| 185 | const callToolAsync = ((toolArgs?: ToolArgs) => { |
| 186 | if (toolArgs === undefined) { |
no outgoing calls
no test coverage detected