# get()

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/mcp/get/
Language: zh

`api.mcp.get(name, { refresh? }) → Promise<Server>`

一个服务器工具。 它再次握手, 重新阅读服务器上的目录, 记录回来的东西 。

Status: free without refresh · refresh contacts the server · keeps your choices

```javascript
const server = await api.mcp.get("example");

for (const tool of server.tools) {
  console.log(tool.allowed ? "✓" : " ", tool.name, "—", tool.description);
}
```

## 每个工具 {#tools}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `name` | string |  | 服务器呼叫它。 |
| `description` | string |  | 模型被告诉什么 |
| `inputSchema` | object |  | 其参数,正如服务器所声明的 |
| `allowed` | boolean |  | 是否被宣布为模式。 |

## 刷新重新读取服务器 {#refresh}

```javascript
const server = await api.mcp.get("example", { refresh: true });
```

|  | 不再刷新 | 以刷新 |
| --- | --- | --- |
| 联系服务器 | 无 无 | 是——握手和工具列表 |
| 费用 | 无 | 往返 |
| 更新目录 | 无 无 | 是,以及商定的修订 |
| 您允许的列表 | 无变化 | **保留** |

> **刷新从不扩大允许的宽度**
>
> 您允许的停留允许工具, 服务器添加的新工具不允许到达。 服务器不能通过运输更多工具而让自己拥有更多表面。

## 何时刷新 {#when}

- 工具开始失败, 出现引力错误, 其计划可能已经改变 。
- 您想要允许的服务器已宣布新工具 。
- `lastError` 显示某物,你想知道它是否仍然真实。

## 信物又会回回给主人 {#token}

`get()` 返回它,因为软件包需要它来联系服务器。它被加密在休息时,并且永远不会离开给其他人——这也是为什么它没有在 [(列表)](/zh/sdk/ref/mcp/list).

- [update()](/zh/sdk/ref/mcp/update): 改变允许的事物。
- [令牌](/zh/sdk/mcp/tokens): 如何处理这些案例。
- [api.mcp](/zh/sdk/ref/mcp): 连接、列出和使用服务器。

```python
server = api.mcp.get("example")

for tool in server["tools"]:
    print("✓" if tool["allowed"] else " ", tool["name"], "—", tool["description"])
```

```python
server = api.mcp.get("example", refresh=True)
```
