函数调用与工具
对标 docs.x.ai 工具指南,Clavue 分三层:① API 上的 OpenAI tools schema;② 官方 MCP 托管工具;③ imux Agent Chat 原生工具(工作区策略下的文件、浏览器、shell)。
API 上的 OpenAI tools
在 chat completions 上发送 tools / tool_choice(模型支持工具时)。由客户端执行 tool call 并回传 role: tool 消息。
{
"model": "clavue-2.1",
"messages": [{"role": "user", "content": "What's the weather in Tokyo?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather by city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}]
}官方 MCP · web_search
托管搜索不是闲聊。使用模型 id clavue-2.1-search 或 MCP 工具 mcp__clavue__web_search。输出为带来源的 agent 规范化 JSON。
imux 原生工具
Agent 模式下 imux 提供绑定工作区根的读/写/搜索/浏览器/shell 工具。Diff 应用前可审阅。非 focus 的 socket 自动化不得抢占 UI 焦点。
- 优先 @file / @symbol,避免整仓 dump
- 只读勘察用 Plan 模式
- 多 agent 舰队 + 验收谓词用 Mission Control