MCPcopy Create free account
hub / github.com/code-with-antonio/nightcode / onToolCall

Function onToolCall

packages/cli/src/hooks/use-chat.ts:68–87  ·  view source on GitHub ↗
({ toolCall })

Source from the content-addressed store, hash-verified

66 messages: initialMessages,
67 transport,
68 onToolCall({ toolCall }) {
69 const mode = chat.messages.at(-1)?.metadata?.mode ?? "BUILD";
70
71 void executeLocalTool(toolCall.toolName, toolCall.input, mode)
72 .then((output) =>
73 chat.addToolOutput({
74 tool: toolCall.toolName as keyof ChatTools,
75 toolCallId: toolCall.toolCallId,
76 output,
77 }),
78 )
79 .catch((error) =>
80 chat.addToolOutput({
81 tool: toolCall.toolName as keyof ChatTools,
82 toolCallId: toolCall.toolCallId,
83 state: "output-error",
84 errorText: error instanceof Error ? error.message : String(error),
85 }),
86 );
87 },
88 sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
89 });
90

Callers

nothing calls this directly

Calls 1

executeLocalToolFunction · 0.90

Tested by

no test coverage detected