English | 中文
Claude Code 是如何定义工具、注册工具,再把模型的工具调用分发到本地执行逻辑的?
python examples/l3_tool_system.pyTool.tstools.tstools/BashTool/tools/FileReadTool/
buildToolgetToolsinputSchemacall
- 为什么模型只看到 schema 和 description
- 工具执行函数为什么不暴露给模型
- 工具注册和过滤为什么是单独一层
示例只保留少量工具和简化权限。真实仓库有更复杂的工具上下文、UI 组件、错误处理和过滤逻辑。
- 为什么“工具 = schema + 函数”的边界特别重要?
- 如果只改工具实现、不改 schema,会影响模型调用策略吗?
- 工具注册表为什么比把逻辑散在各处更适合 Agent 系统?