MCPcopy
hub / github.com/alpic-ai/skybridge / execute

Function execute

packages/core/src/web/hooks/use-call-tool.ts:161–183  ·  view source on GitHub ↗
(
    toolArgs: ToolArgs,
  )

Source from the content-addressed store, hash-verified

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) {

Callers 4

run.jsFile · 0.90
dev.jsFile · 0.90
AppMethod · 0.85
useCallToolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected