# 核验 API 对函数工具调用与 tool_choice 权限矩阵的遵守程度

> Source: LMSpeed (https://lmspeed.net) — https://lmspeed.net/zh/audit/tool-calling. When citing or reusing this content, credit "LMSpeed" and link to https://lmspeed.net/zh/audit/tool-calling.

全面测试 OpenAI 兼容端点对自动选工具（auto）、强制指定函数（forced）、显式禁用（tool_choice: none）及未声明工具拦截的执行是否严格，全程不触发本地执行。

Canonical URL: https://lmspeed.net/zh/audit/tool-calling
Last updated: 2026-12-03T18:58:42.592Z (site data revision; page date not supplied)

Reproduction and quotation must name LMSpeed, link to the canonical HTML URL, and retain individual source citations.

逐项校验自动、强制、禁用及越权调用四类边界行为，确认网关协议转发无字段丢包，全程零本地副作用。

能力边界与质量检测默认套件@lmspeed/audit v0.3.3 · independent-2026-11-24.1

[运行 All-in-One 审计](https://lmspeed.net/zh/audit)[模型指纹识别](https://lmspeed.net/zh/audit/model-fingerprint)

## 近期公开报告

包含当前检测项的近期脱敏分享记录。

- [9r***.dpdns.org

osqoof/gpt-6

检测时间 · 12月2日通过](https://lmspeed.net/zh/audit/N40mYlV6Wi7FIZUZ)

- [9r***.dpdns.org

osqoof/gpt-6

检测时间 · 12月2日通过](https://lmspeed.net/zh/audit/ioQ8Fhj5sRl6FSnv)

- [ap***.ai

claude-opus-5-5

检测时间 · 12月2日未通过](https://lmspeed.net/zh/audit/UE6_9YowLYxNwcPG)

- [ap***.cc

standard/claude-opus-5.5

检测时间 · 12月2日未通过](https://lmspeed.net/zh/audit/tGHasfcva0AHdZFy)

- [fr***.in

deepseek-v4.1-flash-1017

检测时间 · 12月2日未通过](https://lmspeed.net/zh/audit/hiSam9nJebv3-v3K)

- [ap***.vip

Claude Opus 5.5

检测时间 · 12月1日通过](https://lmspeed.net/zh/audit/2JpeaBJGrkHe0Mvz)

## 检测概述与风险背景

工具权限检测验证端点及代理中间件是否完整支持 `tools` 函数描述与各种 `tool_choice` 控制策略。

### 这项检测具体查什么

测试自由调用、强制命中指定函数名、在 `tool_choice: "none"` 下零触发，以及拒绝幻觉调用未声明工具的能力。

### 为什么这个风险重要

许多中转适配层看似兼容 Chat 格式，实际在内部转换时会偷偷丢掉 `tool_choice` 控制位或把强类型 JSON 参数转乱，导致 Agent 死循环或越权调用已禁止的工具。

### 什么时候应该运行

接入需要稳定执行函数调用、MCP 客户端或强制结构化动作路由的智能体框架前必测。

不少协议代理层只在默认 `auto` 状态下看起来能吐出函数名，一旦遇到安全关停开关 `tool_choice: "none"` 依然大摇大摆发起调用，暴露严重的控制面失灵。

## 检测方法论、证据依据与局限边界

通过 @lmspeed/audit 下发包含四类权限矩阵的无副作用探测表单，静态校验回包的 `tool_calls` 字段协议。

- **1. 构造探针**

分别构造自动选择、强制指定单一工具名、显式 `tool_choice: "none"` 的测试载荷。

- **2. 采样核查**

校验强制路径是否精准命中且 JSON 参数完整、`none` 路径是否严格零调用且未凭空伪造未声明工具。

- **3. 证据判定**

输出控制面协议达标结论或指出被代理吞掉的具体权限标志。

### 如何解读判定结果

全部权限模式响应合规记通过；在禁用模式下仍发起调用或无法触发强制工具则判定协议失败。

### 证据依据与判定阈值

auto、forced、none 与未声明工具四象限下响应 `tool_calls` 字段及 JSON 校验结果。

### 能力边界与弃权条件

仅审计工具调用控制面协议与声明约束；涉及返回内容有没有被篡改投毒需另看「工具调用改写（Tool Substitution）」。

### 文献引用与技术基线

本检测集成于 @lmspeed/audit v0.3.3（规则集 independent-2026-11-22.2）；相关注入与能力探针设计同时参考 Veridrop、LLMprobe-engine 与 meow-llm-detector 方法规范。

- [lmspeed/audit (v0.3.3)](https://github.com/nexmoe/lmspeed-audit)LMSpeed 开源探针引擎、统一检测目录与三阶段指纹校准协议实现。

## 常见问题

### 这项测试会在服务端或本地真的执行命令吗？

绝不会。所有工具均为纯协议占位符定义，LMSpeed 拿到响应只验证结构即止，不执行任何外部操作。

### 为什么要专门测 tool_choice: "none"？

安全架构中常用 `none` 限制最终收尾回复不得再拉起高危工具；代理若丢弃该字段会导致严重死循环与越权。

### 与“工具调用改写（Tool Substitution）”怎么区分？

工具权限看「能不能按要求调与不调」；工具调用改写看「参数里面的 npm/pip 包名有没有被偷偷调包」。

### 和严格 JSON 结构化输出测试建议一起看吗？

是的，很多转译网关同时破坏 `tool_choice` 和 `response_format` 两个高级字段。

## 按分类浏览全部审计工具

按风险分类查看 22 个独立检测页面；Fingerprint Detection 置顶展示，用于模型真实性与替换排查。

### 指纹识别（Fingerprint Detection）

置顶 · 重点推荐3

- [模型分布指纹](https://lmspeed.net/zh/audit/model-fingerprint)

- [数字指纹初筛](https://lmspeed.net/zh/audit/numeric-fingerprint)

- [分词器后验指纹](https://lmspeed.net/zh/audit/tokenizer-fingerprint)

### 提示词与注入安全

6

- [Token 注入](https://lmspeed.net/zh/audit/token-injection)

- [Prompt 提取](https://lmspeed.net/zh/audit/prompt-extraction)

- [指令冲突](https://lmspeed.net/zh/audit/instruction-conflict)

- [越狱与身份泄漏](https://lmspeed.net/zh/audit/jailbreak-identity)

- [条件触发注入](https://lmspeed.net/zh/audit/conditional-injection)

- [Web3 注入](https://lmspeed.net/zh/audit/web3-prompt-injection)

### 响应与流式完整性

5

- [流式完整性](https://lmspeed.net/zh/audit/stream-integrity)

- [流式一致性](https://lmspeed.net/zh/audit/stream-consistency)

- [工具调用改写](https://lmspeed.net/zh/audit/tool-substitution)

- [错误泄漏](https://lmspeed.net/zh/audit/error-leakage)

- [延迟方差](https://lmspeed.net/zh/audit/latency-variance)

### 能力边界与质量检测

7

- [上下文窗口与召回](https://lmspeed.net/zh/audit/context-window)

- 工具权限

- [结构化输出](https://lmspeed.net/zh/audit/structured-output)

- [图像理解](https://lmspeed.net/zh/audit/image-understanding)

- [PDF 理解](https://lmspeed.net/zh/audit/pdf-understanding)

- [基础能力金丝雀](https://lmspeed.net/zh/audit/quality-canary)

- [参照质量对比](https://lmspeed.net/zh/audit/quality-comparison)

### 关联测速与评测页面

- [服务商安全审计](https://lmspeed.net/zh/audit)

- [三阶段指纹检测管线](https://lmspeed.net/zh/audit#fingerprint-detection)

- [LLM API 在线测速](https://lmspeed.net/zh/speed)

- [API 服务商目录](https://lmspeed.net/zh/provider)

- [模型列表与定价](https://lmspeed.net/zh/model)

- [平台评测方法论](https://lmspeed.net/zh/methodology)

---
Cite as: 核验 API 对函数工具调用与 tool_choice 权限矩阵的遵守程度 — LMSpeed, https://lmspeed.net/zh/audit/tool-calling (retrieved 2026-12-04)
