MCPcopy Create free account
hub / github.com/echoVic/blade-code / callTool

Method callTool

src/agent/ToolComponent.ts:117–138  ·  view source on GitHub ↗

* 调用工具

(request: ToolCallRequest)

Source from the content-addressed store, hash-verified

115 * 调用工具
116 */
117 public async callTool(request: ToolCallRequest): Promise<ToolCallResponse> {
118 if (!this.toolManager) {
119 throw new Error('工具组件未初始化');
120 }
121
122 const startTime = Date.now();
123
124 try {
125 const response = await this.toolManager.callTool(request);
126 const duration = Date.now() - startTime;
127
128 this.log(`工具调用完成: ${request.toolName}`, {
129 success: response.result.success,
130 duration,
131 });
132
133 return response;
134 } catch (error) {
135 this.error(`工具调用失败: ${request.toolName}`, error);
136 throw error;
137 }
138 }
139
140 /**
141 * 获取所有工具

Callers

nothing calls this directly

Calls 2

logMethod · 0.95
errorMethod · 0.95

Tested by

no test coverage detected