用途:当本地工具无法提供所需能力时,用此技能接入 SAM agent mesh,仅取完成任务所需的能力,优先使用本地工具。
主要能力:检查本地节点与网格状态(get_mesh_info、list_local_services);发现远程服务(discover_remote_services,类型 mcp/inference/a2a)与远程 MCP 工具(find_remote_tools);调用前先用 describe_remote_tool 查看名称、描述与输入 schema,再用 call_remote_tool 调用;通过 OpenAI 兼容的 /v1 端点使用网格推理(GET /v1/models、POST /v1/chat/completions)。
使用方式:若 sam-node MCP 工具不可用,先引导用户安装并启动节点:sam-node --help;缺失时用 curl -sL https://sam-mesh.dev/install.sh | bash 或 go install github.com/google/sam/cmd/sam-node@latest;sam-node run --daemonize;未注册时运行 sam-node join --headless <control-plane-url>。随后读取节点 API token,注册 MCP 端点 http://127.0.0.1:8080/mcp,请求头 X-Sam-Authentication: Bearer <token>,并重启 agent 会话。HTTP 访问优先用 Unix socket(默认 ~/.config/sam-mesh/sam.sock,无需 token),否则用 TCP 端点加 token。诊断用 sam-node debug mesh-info、connectivity、network-info、token-info、logs、connect-peer。
适用场景:需要远程工具或能力、模型补全、网格状态排查,以及节点已启动但网格异常时的诊断。
限制:远程工具名带命名空间(如 mcp://everything/get-sum),须原样传给 describe_remote_tool 与 call_remote_tool,不得猜测名称或参数;非 MCP 服务类型不能用 call_remote_tool 调用;发现为尽力而为,可能返回空数组或带 error 字段。仅可自主调用只读、低风险工具;可能改变状态、执行代码、访问文件、联系外部服务、花钱或传输敏感数据的调用须先征得用户同意。不要向网格发送密钥或隐私数据,除非用户明确批准数据与目的地。token 只放在 MCP 配置中,不要回显或提交。重置(sam-node reset --all --yes)会删除节点身份与 PeerID,需重新登录,不得用于绕过未知错误。