api.mcp

get()

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

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

free without refreshrefresh contacts the serverkeeps your choices
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

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

for (const tool of server.tools) {
  console.log(tool.allowed ? "✓" : " ", tool.name, "—", tool.description);
}
server = api.mcp.get("example")

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

每个工具

namestring

服务器呼叫它。

descriptionstring

模型被告诉什么

inputSchemaobject

其参数,正如服务器所声明的

allowedboolean

是否被宣布为模式。

刷新重新读取服务器

const server = await api.mcp.get("example", { refresh: true });
server = api.mcp.get("example", refresh=True)
不再刷新以刷新
联系服务器无 无是——握手和工具列表
费用无往返
更新目录无 无是,以及商定的修订
您允许的列表无变化保留
刷新从不扩大允许的宽度

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

何时刷新

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

信物又会回回给主人

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