# 发现 □ 被拒绝的工具

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/mcp-client/discovered/
Language: zh

握手者对服务器学到了什么,以及服务器的哪些工具不能申报——命名,而不是悄悄地放下。

Status: read after initialize · rejections are named · invalid definitions

```javascript
await client.initialize();
const tools = await client.listTools();

console.log(client.protocolVersion);   // the revision both sides agreed on
console.log(client.rejectedTools);     // [{ name, reason }]
```

## 为何拒绝使用工具 {#why-rejected}

| 原因原因原因原因原因原因原因 | 含义 |
| --- | --- |
| 无法使用的名称 | 任何事物都不能幸存于前置和修剪。 |
| 无法读取的页头注释 | 它处于一种可以分解的结构之下,因此在论点中没有一条可阅读的单一路径——该说明称这样一个定义无效。 |

> **已经命名拒绝的工具, 而不是隐藏**
>
> 静静地丢下它会留下服务器自己的文件, 保证一个从未出现的工具, 没有任何线索。 原因是发送给操作服务器的人。

## 协议协议协议 {#protocol}

客户并不喜欢这个客户所喜欢的,服务器所喜欢的不是这个客户所喜欢的,服务器所喜欢的不是——这两个人都知道的。它记录在连接上,可见于 [(列表)](/zh/sdk/ref/mcp/list).

## 冲着它 {#surfacing}

```javascript
if (client.rejectedTools.length) {
  console.warn("not declarable:", client.rejectedTools.map((t) => `${t.name} (${t.reason})`).join(", "));
}
```

- [listTools()](/zh/sdk/ref/mcp-client/list-tools): 拒绝时。
- [协议版本](/zh/sdk/mcp/protocol-revision): 谈判

```python
client.initialize()
tools = client.list_tools()

print(client.protocol_version)   # the revision both sides agreed on
```

```python
# The Python client returns every tool the server lists; check each schema yourself
from iagenify import sanitize_schema

declarable = [t for t in tools if sanitize_schema(t.get("inputSchema") or {}).get("type") == "object"]
skipped = [t["name"] for t in tools if t not in declarable]
if skipped:
    print("not declarable:", ", ".join(skipped))
```
