tool-selector

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Tool Selector Protocol

工具选择器协议

Determine which tools are needed to solve the task, plan the most efficient sequence, and eliminate unnecessary calls before they happen.
Core principle: Every tool call costs time, tokens, and rate limits. The right tool, in the right order, called once.

确定解决任务所需的工具,规划最高效的执行顺序,并提前避免不必要的工具调用。
核心原则:每次工具调用都会消耗时间、令牌(tokens)和调用限额。要选择正确的工具,按正确的顺序,只调用一次。

Tool Catalog

工具目录

ToolCostSide EffectBest For
Web searchMediumNone (read-only)Current info, external sources
Code executionMediumEnvironment-dependentComputation, transformation, testing
File readLowNoneLocal data, config, content
File writeMediumPersistent changeSaving output, updates
API callHighRate limits, costExternal service integration
Database queryMedium-HighPersistent on writesData read/write
Memory/contextLowNoneRetrieve previous information

工具成本副作用最佳适用场景
网页搜索中等无(只读)最新信息、外部资源
代码执行中等取决于运行环境计算、转换、测试
文件读取本地数据、配置、内容
文件写入中等产生持久化变更保存输出、更新内容
API调用受调用限额、成本限制外部服务集成
数据库查询中-高写入操作会产生持久化变更数据读写
内存/上下文检索历史信息

Selection Algorithm

选择算法

For each tool candidate, ask these questions in order:
1. Can this tool actually solve this task?           → No = eliminate
2. Can a cheaper/simpler tool do the same job?       → Yes = use that instead
3. Was this tool already called for this task?        → Yes = use cached result
4. Is this call actually needed right now?            → No = defer
5. Does this tool depend on another tool's output?    → Yes = add to sequence

对于每个候选工具,按顺序提出以下问题:
1. Can this tool actually solve this task?           → No = eliminate
2. Can a cheaper/simpler tool do the same job?       → Yes = use that instead
3. Was this tool already called for this task?        → Yes = use cached result
4. Is this call actually needed right now?            → No = defer
5. Does this tool depend on another tool's output?    → Yes = add to sequence

Anti-Patterns — Block These

反模式 — 需避免

Anti-PatternProblemSolution
Reading the same file repeatedlyEach read costs tokensCache on first read
Web search for known informationUnnecessary latencyUse existing knowledge
Serial API calls (could be parallel)SlowPlan parallel calls
Tool chain when one tool sufficesExtra stepsConsolidate
Read before write (when unnecessary)Extra callSkip the read
Loading memory every stepToken wasteLoad once, reference

反模式问题解决方案
重复读取同一文件每次读取都会消耗令牌首次读取后缓存结果
对已知信息进行网页搜索造成不必要的延迟使用已有知识
串行API调用(可并行)速度慢规划并行调用
可用单个工具却使用工具链额外步骤合并操作
不必要的先读后写额外调用跳过读取步骤
每步都加载内存浪费令牌加载一次后复用

Output Format

输出格式

TOOL SELECTOR
Task    : [task summary]
Selected: N tools | Total calls: N | Blocked: N
TOOL SELECTOR
Task    : [task summary]
Selected: N tools | Total calls: N | Blocked: N

Tool Plan

Tool Plan

StepToolPurposeDepends OnCached?
1[tool][why]No
2[tool][why]#1Yes — use #1 output
StepToolPurposeDepends OnCached?
1[tool][why]No
2[tool][why]#1Yes — use #1 output

Blocked Calls

Blocked Calls

BlockedReasonAlternative
[tool call][rationale][what to do instead]
BlockedReasonAlternative
[tool call][rationale][what to do instead]

Optimization Notes

Optimization Notes

  • [Parallel opportunities]
  • [Cached outputs]
  • [Rate limit warnings]
Approve? Proceed?

---
  • [Parallel opportunities]
  • [Cached outputs]
  • [Rate limit warnings]
Approve? Proceed?

---

Tool Combination Guide

工具组合指南

Task TypeTypical ChainBlock
Research & ReportSearch → File read → Code (analyze) → File writeSearching same topic twice
Data ProcessingFile read → Code → File writeRe-reading file each step
API IntegrationMemory (creds) → API → Code (parse) → DB writeRe-auth per request
Code DevelopmentFile read → Code (test) → File write → Code (verify)Full test suite on every change
Database OperationMemory (schema) → DB (SELECT) → Code (prepare) → DB (write)Running same SELECT twice

任务类型典型工具链需避免的操作
研究与报告网页搜索 → 文件读取 → 代码(分析)→ 文件写入重复搜索同一主题
数据处理文件读取 → 代码执行 → 文件写入每步重复读取文件
API集成内存(凭证)→ API调用 → 代码(解析)→ 数据库写入每次请求重复认证
代码开发文件读取 → 代码(测试)→ 文件写入 → 代码(验证)每次变更都运行完整测试套件
数据库操作内存(Schema)→ 数据库(查询)→ 代码(预处理)→ 数据库(写入)重复执行同一查询

When to Skip

跳过场景

  • Single-tool task ("read this file")
  • User already specified which tool to use
  • Single-step, side-effect-free task

  • 单工具任务(如“读取此文件”)
  • 用户已指定要使用的工具
  • 单步骤、无副作用的任务

Guardrails

防护规则

  • Never call an API when cached data suffices — always check cache first.
  • Prefer low-cost tools — file read over web search when local data exists.
  • Cross-skill: works with
    parallel-planner
    (parallel tool calls) and
    task-decomposer
    (tool needs per subtask).
  • 当缓存数据可用时,绝不调用API — 始终先检查缓存。
  • 优先使用低成本工具 — 当存在本地数据时,优先使用文件读取而非网页搜索。
  • 跨技能兼容:可与
    parallel-planner
    (并行工具调用)和
    task-decomposer
    (子任务工具需求)配合使用。