MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / executeTool

Function executeTool

packages/agent-core/src/loop/tool-call.ts:539–565  ·  view source on GitHub ↗
(
  step: ToolCallStepContext,
  execution: RunnableToolExecution,
  toolCall: ToolCall,
  toolName: string,
  metadata: unknown,
)

Source from the content-addressed store, hash-verified

537}
538
539async function executeTool(
540 step: ToolCallStepContext,
541 execution: RunnableToolExecution,
542 toolCall: ToolCall,
543 toolName: string,
544 metadata: unknown,
545): Promise<ExecutableToolResult> {
546 const { dispatchEvent, signal, turnId } = step;
547
548 signal.throwIfAborted();
549
550 const executePromise = execution.execute({
551 turnId,
552 toolCallId: toolCall.id,
553 metadata,
554 signal,
555 onUpdate: (update) => {
556 if (signal.aborted) return;
557 dispatchEvent({
558 type: 'tool.progress',
559 toolCallId: toolCall.id,
560 update,
561 });
562 },
563 });
564 return raceExecuteWithGraceTimeout(executePromise, signal, toolName);
565}
566
567async function raceExecuteWithGraceTimeout(
568 executePromise: Promise<ExecutableToolResult>,

Callers 1

runRunnableToolCallFunction · 0.70

Calls 4

dispatchEventFunction · 0.85
throwIfAbortedMethod · 0.80
executeMethod · 0.80

Tested by

no test coverage detected