* 启用/禁用工具
(toolName: string, enabled: boolean)
| 124 | * 启用/禁用工具 |
| 125 | */ |
| 126 | public setToolEnabled(toolName: string, enabled: boolean): void { |
| 127 | const state = this.toolStates.get(toolName); |
| 128 | if (!state) { |
| 129 | throw new ToolRegistrationError(`工具 "${toolName}" 不存在`, toolName); |
| 130 | } |
| 131 | |
| 132 | state.enabled = enabled; |
| 133 | this.log(`工具 "${toolName}" ${enabled ? '已启用' : '已禁用'}`); |
| 134 | |
| 135 | this.emit('toolStateChanged', { toolName, enabled }); |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * 检查工具是否启用 |