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

Method validateToolDefinition

src/tools/ToolManager.ts:317–333  ·  view source on GitHub ↗

* 验证工具定义

(tool: ToolDefinition)

Source from the content-addressed store, hash-verified

315 * 验证工具定义
316 */
317 private validateToolDefinition(tool: ToolDefinition): void {
318 if (!tool.name || typeof tool.name !== 'string') {
319 throw new ToolRegistrationError('工具名称必须是非空字符串');
320 }
321
322 if (!tool.description || typeof tool.description !== 'string') {
323 throw new ToolRegistrationError('工具描述必须是非空字符串');
324 }
325
326 if (!tool.parameters || typeof tool.parameters !== 'object') {
327 throw new ToolRegistrationError('工具参数定义必须是对象');
328 }
329
330 if (typeof tool.execute !== 'function') {
331 throw new ToolRegistrationError('工具执行函数必须是函数');
332 }
333 }
334
335 /**
336 * 执行工具并设置超时

Callers 1

registerToolMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected