Adding MCP Tools to Reachy Mini

Adding MCP Tools to Reachy Mini

为 Reachy Mini 添加 MCP 工具

Reachy Mini no longer has to look out the window to tell you the weather. The Reachy Mini conversation app can now use tools hosted in public Hugging Face Spaces, called over MCP. You can give your robot a new ability, like checking the weather or searching the web, by adding a Space from the Hub instead of editing the app. The tool keeps running in the Space itself, so no code is downloaded onto your machine. And you can publish your own tools for other people to use. Reachy Mini 不再需要盯着窗外才能告诉你天气了。现在,Reachy Mini 对话应用可以通过 MCP(Model Context Protocol)调用托管在公共 Hugging Face Spaces 中的工具。你无需修改应用代码,只需从 Hugging Face Hub 添加一个 Space,就能赋予机器人诸如查询天气或搜索网络等新能力。工具本身在 Space 中运行,因此无需将任何代码下载到你的本地机器上。此外,你还可以发布自己的工具供他人使用。

Adding a tool takes one command: 添加工具只需一条命令:

reachy-mini-conversation-app tool-spaces add pollen-robotics/reachy-mini-weather-tool

Then start the app as usual: 然后像往常一样启动应用:

reachy-mini-conversation-app

Now you can just ask: “What’s the weather in Paris today?” Below, we look at what a tool is, how profiles control what the robot can use, and the current limits of the remote path. 现在你只需问它:“巴黎今天天气怎么样?” 下面,我们将探讨什么是工具、配置文件如何控制机器人的可用功能,以及远程调用路径目前的局限性。

Built-in tools

内置工具

When you talk to the robot, what you get back isn’t only a voice, it’s a system that reacts to the conversation: the robot can move and respond non-verbally, when it’s applicable. The part we want to focus on here is the tools that make that possible. A tool is something the model can do during a conversation: play an emotion, move the head, look through the camera. Each tool has a name and a short description. The model reads those, decides when one is useful, calls it, and uses what comes back. 当你与机器人交谈时,得到的不仅仅是语音回复,而是一个会对对话做出反应的系统:在适当的情况下,机器人可以移动并进行非语言回应。我们这里重点关注的是实现这一功能的“工具”。工具是指模型在对话过程中可以执行的操作:播放表情、移动头部、通过摄像头观察等。每个工具都有一个名称和简短描述。模型会读取这些信息,判断何时需要使用某个工具,调用它,并使用返回的结果。

Today every tool is local and ships inside the app, and most of them are about the robot’s body: 目前,所有工具都是本地的,并随应用内置,其中大多数与机器人的身体动作有关:

ToolWhat it does
move_headQueue a head pose change
dance / stop_dancePlay or clear a dance from the dances library
play_emotion / stop_emotionPlay or clear a recorded emotion clip
head_trackingToggle head-tracking offsets
cameraCapture a frame and analyze it
idle_do_nothingExplicitly stay idle on an idle turn
工具功能描述
move_head排队执行头部姿态变更
dance / stop_dance播放或清除舞蹈库中的舞蹈
play_emotion / stop_emotion播放或清除录制的表情片段
head_tracking切换头部追踪偏移量
camera捕获并分析一帧图像
idle_do_nothing在空闲轮次中明确保持空闲

How profiles control tools

配置文件如何控制工具

A tool in the code isn’t usable until it’s enabled in a profile, a folder with two files that matter here: instructions.txt (the prompt) and tools.txt (the tools that are turned on). The default profile enables the full set: 代码中的工具只有在配置文件中启用后才能使用。配置文件是一个包含两个关键文件的文件夹:instructions.txt(提示词)和 tools.txt(已启用的工具)。默认配置文件启用了全套工具:

# profiles/default/tools.txt
dance
stop_dance
play_emotion
stop_emotion
camera
idle_do_nothing
head_tracking
move_head

If a name isn’t in tools.txt, the model can’t call it. You can also write your own tool: add a Python file to the profile (or external_tools/), give it a name and description, and list that name in tools.txt. Today there are built-in tools and custom local tools, and tools.txt decides which are active. This works well for the robot’s body and keeps the trusted core small. 如果某个名称不在 tools.txt 中,模型就无法调用它。你也可以编写自己的工具:在配置文件(或 external_tools/)中添加一个 Python 文件,为其命名并编写描述,然后在 tools.txt 中列出该名称。目前,系统包含内置工具和自定义本地工具,而 tools.txt 决定了哪些工具处于激活状态。这种方式对于控制机器人身体非常有效,并保持了核心信任域的精简。

The limits of local tools

本地工具的局限性

The constraint here is that every tool has to be local Python. For move_head or play_emotion that’s right: they talk to the hardware and belong in the app. But a lot of useful things have nothing to do with the body, like web search, weather, or lookups. For those, keeping everything local is mostly friction: sharing a tool means handing someone your Python files, updating it means sending those files again, changing it means editing the app, even though the capability is really separate from it. 目前的限制在于,每个工具都必须是本地的 Python 代码。对于 move_headplay_emotion 来说,这是合理的:它们需要与硬件交互,属于应用的一部分。但许多有用的功能与机器人的身体无关,例如网络搜索、天气查询或数据检索。对于这些功能,一切保持本地化会带来很多麻烦:分享工具意味着要给别人发送 Python 文件,更新工具意味着要再次发送文件,修改工具则意味着要编辑应用本身,尽管这些功能实际上与应用逻辑是分离的。

Calling tools from Spaces

从 Spaces 调用工具

Remote tools add a third kind, alongside the built-in and custom local tools you already have, for capabilities that are easier to publish, share, and update on their own: 远程工具作为内置工具和自定义本地工具之外的第三种类型,为那些更易于独立发布、共享和更新的功能提供了支持:

  • Built-in robot tools stay local and trusted.

  • Shareable remote tools can live in public Hugging Face Spaces.

  • You can still use custom one-off tools from external_tools/.

  • 内置机器人工具保持本地化且可信。

  • 可共享的远程工具可以托管在公共 Hugging Face Spaces 中。

  • 你仍然可以使用来自 external_tools/ 的自定义一次性工具。

It’s a good fit for stateless capabilities like search, weather, and lookups: anything you want to iterate on without touching the app itself. And because anyone can publish a compatible Space, it’s easy to share tools and build on each other’s work. 这非常适合无状态功能,如搜索、天气和查询:任何你希望在不触碰应用本身的情况下进行迭代的功能。而且由于任何人都可以发布兼容的 Space,分享工具并基于他人的工作进行构建变得非常容易。

We started with two canary tools, small test tools to exercise the new flow: 我们首先推出了两个“金丝雀”工具,作为测试新流程的小型工具:

  • pollen-robotics/reachy-mini-search-tool
  • pollen-robotics/reachy-mini-weather-tool

They’re enough to exercise the whole feature: install from the Hub, discover the remote tools, enable them per profile, and let the realtime backend call them exactly like built-in tools. To use both at once, add each Space and their tools stack in the same profile: 它们足以验证整个功能:从 Hub 安装、发现远程工具、按配置文件启用,并让实时后端像调用内置工具一样调用它们。要同时使用这两个工具,请将每个 Space 及其工具栈添加到同一个配置文件中:

reachy-mini-conversation-app tool-spaces add pollen-robotics/reachy-mini-search-tool
reachy-mini-conversation-app tool-spaces add pollen-robotics/reachy-mini-weather-tool

Now the robot can search the web and check the weather in the same conversation, which is exactly what the canary_web_search_weather profile below does. 现在,机器人可以在同一次对话中搜索网络并查询天气,这正是下面 canary_web_search_weather 配置文件所实现的功能。

Install, list, remove

安装、列出、移除

# install + enable in active profile
reachy-mini-conversation-app tool-spaces add <owner/space-name>

# enable in a specific profile
reachy-mini-conversation-app tool-spaces add <owner/space-name> --profile <NAME>

# install without enabling
reachy-mini-conversation-app tool-spaces add <owner/space-name> --install-only

# list installed spaces
reachy-mini-conversation-app tool-spaces list

# remove an installed space
reachy-mini-conversation-app tool-spaces remove <owner/space-name>

add validates the Space on the Hub, probes the MCP endpoint, discovers its tools, and by default appends the tool IDs to the active profile’s tools.txt. The active profile is default unless you’ve set REACHY_MINI_CUSTOM_PROFILE. Use --install-only to skip that step. tools.txt is the gatekeeper: a remote tool is only active if its ID appears in the profile’s tools.txt, alongside whatever built-in tools you want. add 命令会验证 Hub 上的 Space,探测 MCP 端点,发现其工具,并默认将工具 ID 追加到当前配置文件的 tools.txt 中。除非你设置了 REACHY_MINI_CUSTOM_PROFILE,否则默认配置文件为 default。使用 --install-only 可以跳过自动启用步骤。tools.txt 是守门人:只有当远程工具的 ID 出现在配置文件的 tools.txt 中(以及你想要的任何内置工具旁边)时,它才会被激活。

Where the manifest lives

清单文件的位置

Installed sources are persisted in: 已安装的源持久化存储在:

  • installed_tool_spaces.json in managed app mode

  • external_content/installed_tool_spaces.json in terminal mode

  • 托管应用模式下的 installed_tool_spaces.json

  • 终端模式下的 external_content/installed_tool_spaces.json

Tool naming

工具命名

Each installed Space gets a local alias derived from its slug, with hyphens, dots, and slashes collapsing to underscores: 每个已安装的 Space 都会获得一个从其 slug 派生的本地别名,其中的连字符、点和斜杠会合并为下划线:

pollen-robotics/reachy-mini-search-toolpollen_robotics_reachy_mini_search_tool

Remote tools are then namespaced with a double underscore: 远程工具随后会使用双下划线进行命名空间隔离:

pollen_robotics_reachy_mini_search_tool__search_web pollen_robotics_reachy_mini_weather_tool__get_day_brief