问题所在
LLM 在两种货币上付出代价:令牌和注意力。系统提示中注入的每个工具定义都会消耗两者。单个 MCP 服务器可以暴露 90 多个工具。五个 API 连接器,每个 20 个操作,产生 100 个工具定义。三个数据库连接器,每个 30 个表,生成另外 90 个模式描述。在用户甚至输入一个字之前,系统提示就可以消耗 50-100KB 的上下文 — 128K 模型预算的一半。 代价不仅仅是令牌。研究和实践一致表明,随着无关上下文的增长,LLM 的准确性会下降。 系统提示中有 80 个工具定义的智能体在工具选择上的表现明显不如只有 6 个工具的智能体。模型将注意力花在它永远不会使用的工具模式上,削弱了它对重要工具和指令的关注。 天真的解决方案 — 注入所有内容,让模型自己理清 — 无法扩展。FIM One 采取相反的方法:向 LLM 展示做出决策所需的最少信息,让它在需要时请求更多。模式
渐进式披露在所有资源类型中遵循两层架构:- 第 1 层 — 系统提示中的存根。 轻量级摘要:名称、简短描述和足够的元数据(操作计数、表计数、工具计数),供 LLM 决定是否需要更多信息。
- 第 2 层 — 按需提供完整详情。 LLM 调用元工具来检索完整的模式、参数和执行能力。完整详情作为工具结果消息进入对话 — 仅限于该轮次,不会永久占用系统提示。
Five disclosure mechanisms
FIM One applies progressive disclosure uniformly across five resource types. Each uses the same two-tier pattern but with a meta-tool tailored to its semantics.Skills — read_skill
What the LLM sees initially:
SKILL_STUB_DESC_LENGTH).
What happens on demand: The LLM calls read_skill("Customer Complaint SOP") and receives the complete SOP text — potentially thousands of tokens of step-by-step instructions, decision trees, and embedded scripts. This content enters as a tool result, not as system prompt text, so it is subject to normal context management (summarization, truncation) in later turns.
Legacy mode: SKILL_TOOL_MODE=inline embeds the full Skill content directly in the system prompt. Suitable when you have few, small Skills — but scales poorly.
Context savings: A deployment with 10 Skills averaging 2,000 tokens each consumes ~300 tokens in progressive mode (stubs only) vs. ~20,000 tokens in inline mode. That is a 98% reduction in persistent context cost.
API 连接器 — connector
LLM 最初看到的内容:
connector("discover", "salesforce") 返回完整的操作模式,包括 HTTP 方法、URL 路径、参数 JSON 模式和请求体模板。connector("execute", "salesforce", "get_contacts", {"limit": 10}) 通过 ConnectorToolAdapter 代理执行,具有完整的身份验证注入和审计日志记录。
旧版模式: CONNECTOR_TOOL_MODE=legacy 将每个操作注册为单独的工具(salesforce__get_contacts、salesforce__create_lead 等)。具有 20 个操作的连接器在系统提示中变成 20 个工具定义。
上下文节省: 具有 15 个操作的连接器生成约 50 个令牌的存根,而完整模式约 3,000 个令牌。五个连接器:约 250 个令牌渐进式 vs. 约 15,000 个令牌旧版。
数据库连接器 — database
LLM 最初看到的内容:
database("list_tables", "hr_postgres")— 返回所有表名称、描述和列计数。database("discover", "hr_postgres", table="employees")— 返回完整的列架构(名称、类型、可为空、主键、描述)。database("query", "hr_postgres", sql="SELECT ...")— 执行经过验证的 SQL 查询,包含安全检查和行限制。
DATABASE_TOOL_MODE=legacy 为每个数据库注册三个工具({db}__list_tables、{db}__describe_table、{db}__query)。对于 5 个数据库连接器,这是 15 个工具定义而不是 1 个。
上下文节省: 具有 30 个表和 200 列的数据库生成约 80 个令牌的存根,而完整架构生成约 5,000 个令牌。节省会随着多个数据库而增加。
MCP 服务器 — mcp
LLM 最初看到的内容:
mcp("discover", "github") 返回完整的工具目录和参数模式。mcp("call", "github", "create_issue", {"title": "Bug report", "body": "..."}) 委托给存储的 MCPToolAdapter,该适配器与 MCP 服务器进程通信。
旧版模式: MCP_TOOL_MODE=legacy 将每个 MCP 工具注册为单独的工具(github__create_issue、github__list_repos 等)。这很容易超过工具选择阈值并触发不必要的选择阶段。
上下文节省: 这里的节省是极端的。GitHub MCP 服务器的 35 个工具可能消耗 10,000+ 个 token 的模式。在渐进式模式下,存根成本约为 100 个 token。如果用户在该对话中从不需要 GitHub,那么这 10,000 个 token 永远不会被消耗。
Built-in Tools — request_tools
The fifth mechanism is architecturally different from the other four. It does not consolidate a resource type behind a meta-tool. Instead, it addresses the tool selection bottleneck — what happens when the agent has more than 12 tools available.
How it works: When the total tool count exceeds REACT_TOOL_SELECTION_THRESHOLD (default: 12), the ReAct engine selects up to 6 relevant tools for the current query (a keyword match first, a lightweight fast-LLM call otherwise) and adds pinned tools such as read_skill and update_plan on top. The remaining tools are stored in a full registry. A request_tools meta-tool is automatically registered, listing all unloaded tools as a compact catalog (name + 80-character description).
What the LLM sees initially:
request_tools(tool_names=["web_search", "email_send"]) copies those tools from the full registry into the active registry. The system prompt is rebuilt on the next iteration so the LLM sees the full schemas. This is a side-effect — the tool mutates the active tool set mid-conversation.
No env var: This mechanism activates automatically when tool selection filters the set. There is no REQUEST_TOOLS_MODE environment variable. If you want to disable tool selection entirely, set REACT_TOOL_SELECTION_THRESHOLD to a very high number.
Context savings: The savings depend on how many tools are available and how many the selection picks. An agent with 30 tools seeing only 6 active schemas + the request_tools catalog saves roughly 60—70% of the tool schema context.
How it fits into the tool assembly pipeline
The System Overview describes an 8-step per-request tool assembly pipeline. Progressive disclosure acts at multiple points:
The net effect: steps 4—6 each reduce their tool count to 1 (or a small constant), and step 8 adds a safety net for dynamically loading anything the selection phase missed. An agent that would have 50+ tools in legacy mode might present 8—10 in progressive mode — well below the selection threshold.
配置
四个环境变量控制渐进式披露,每个资源类型一个:
智能体级别覆盖。 每个环境变量可以通过
model_config_json 字段按智能体覆盖:
progressive(默认值)并有选择地为特定智能体覆盖。具有单个小技能的智能体可能使用 inline 模式。需要 LLM 提前看到所有连接器操作的智能体(例如,不能可靠地调用元工具的微调模型)可能使用 legacy 模式。
request_tools 没有配置。 当工具选择产生过滤的子集时,它会自动激活。阈值由 REACT_TOOL_SELECTION_THRESHOLD(默认值:12)控制,最大选择计数由 REACT_TOOL_SELECTION_MAX(默认值:6)控制。
设计决策
为什么选择显式(LLM驱动)而非隐式(框架驱动)?
另一种设计方案是让框架根据启发式方法自动扩展工具模式 — 例如,检测用户查询涉及的连接器,并在LLM看到提示词前注入其模式。FIM One 刻意选择了LLM驱动的方法,原因有三:- LLM 在意图检测上优于启发式方法。 像”检查客户是否有未解决的工单并更新其资料”这样的查询涉及两个连接器。基于关键词的启发式匹配很脆弱;LLM 能自然地识别两者。
-
透明度。 当LLM调用
connector("discover", "jira")时,该操作会出现在工具追踪中。用户(以及进行调试的开发者)可以清楚地看到加载了哪些模式以及何时加载。隐式扩展是不可见的。 - 上下文效率。 框架无法知道LLM需要连接器内的哪些操作。扩展连接器的所有操作会在无关的操作上浪费token。LLM 首先看到操作名称(通过存根),然后仅请求特定操作的模式 — 这是两层级披露的最纯粹形式。
Why per-resource meta-tools rather than one universal tool?
A singlediscover_resource(type, name) tool would be simpler to implement but worse for the LLM. Per-resource meta-tools provide:
- Typed parameters.
connectorhassubcommand,connector,action,parameters.databasehassubcommand,database,table,sql. The parameter schemas tell the LLM exactly what is expected. - Enum constraints. Each meta-tool lists its valid names (connector names, database names, server names) as enum values in the schema. The LLM cannot hallucinate a connector name.
- Category semantics. The
connectortool has categoryconnector,databasehas categorydatabase,mcphas categorymcp. An agent’stool_categoriesfilter applies to built-in tools only; which meta-tools appear is decided by the agent’s bound connectors and MCP servers.
为什么同时支持渐进式和传统模式?
并非所有 LLM 都能同样好地处理元工具。较小的或微调的模型可能在两步发现-然后-执行的模式中遇到困难。传统模式提供了一个直接的备选方案,其中每个操作都是一个独立的工具,其完整的模式是可见的——不需要元工具间接调用。 双模式设计也支持迁移。现有部署可以通过更改单个环境变量,逐步切换到渐进式模式,一次测试一个资源类型。每个环境变量充当功能开关——影响范围仅限于单个资源类型,回滚只需改变一行配置。 第三个更实际的原因:调试。 在传统模式中,每个工具调用都是显式的、自包含的——salesforce__get_contacts(limit=10) 在日志和追踪中立即可读。在渐进式模式中,相同的调用是 connector("execute", "salesforce", "get_contacts", {"limit": 10}) ——一个额外的间接层,需要解析元工具参数才能理解实际发生了什么。在开发和故障排除期间,将单个资源类型切换回传统模式可以显著加快诊断速度,而不会影响其他资源类型。