每个内置工具都有一个类型化的插槽:executor 端用 client.tools.<name>.handle 处理,harness 端用 session.tools.<name>.call 调用。处理器收到该工具的输入(缺少必填成员的调用会在处理器运行前失败),返回文本、内容块、工具结果,或对 bash 返回 bash 结果。注册处理器会声明 shell 或 files 能力;抛出 ToolError 会以 is_error: true 报告给模型,其他错误则为 outcome: "failed"。
由 bma-executor-sdk 1.12.2 及其契约(contracts/bma/executor,协议 bma.executor.v1.1)生成。安装、凭据与快速开始见 bma-executor-sdk 概览;协议本身见 Executor 协议。

工具插槽(executor 端)

每个 client.tools.<name> 背后的通用插槽;各工具小节按该工具的输入类型展示它。

工具插槽(harness 端)

每个 session.tools.<name> 背后的通用入口;它发送 tool.call 并等待 tool.result,与 callTool 相同。

ToolContext

处理器可获得的所服务调用的信息,以及用于发送 tool.progress 更新的 progress。

BashResult

一条已完成的命令,渲染为 stdout、stderr 和 exit_code: N;超过 48 KiB(或标记为已截断)的输出会被截成预览。

ToolError

报告给模型的工具级错误(outcome 为 succeeded,is_error: true),作用与 Anthropic SDK 的 ToolError 相同。

内置工具

bash

bash 输入:用登录 shell 运行命令。 输入 BashInput Executor 端
Harness 端
示例

read

read 输入:返回文本文件的若干行。 输入 ReadInput Executor 端
Harness 端
示例

write

write 输入:创建或替换文件。 输入 WriteInput Executor 端
Harness 端
示例

edit

edit 输入:替换 old_string 唯一的那一处出现。 输入 EditInput Executor 端
Harness 端
示例

glob

glob 输入:列出与 pattern 匹配的路径。 输入 GlobInput Executor 端
Harness 端
示例

grep

grep 输入:用正则表达式搜索文件中的行。 输入 GrepInput Executor 端
Harness 端
示例

list_files

list_files 输入。 输入 ListFilesInput Executor 端
Harness 端
示例

computer_observe

computer_observe 的输入。结果是一张截图(image content block),并以文本形式附带屏幕上的窗口列表。pid 与 window_id(须同时给出或同时省略,契约 1.8.0)用于观察该列表中的某一个窗口。region(契约 1.17.0)用于放大:结果是截图中该区域按完整屏幕分辨率返回的部分。 输入 ComputerObserveInput Executor 端
Harness 端

computer_action

computer_action 的输入,参照 Anthropic 的 computer-use 工具,基于 ComputerAction 枚举。坐标为最近一次 computer_observe 截图的像素(带 pid 与 window_id 时为窗口内坐标)。display 之后的成员属于契约 1.8.0(增量)。duration 与 actions 属于契约 1.17.0:动作批次 batch 带 actions 时按顺序执行这些步骤,遇到第一个失败即停止,并以最后一步目标(屏幕或其窗口)的截图结束。 输入 ComputerActionInput Executor 端
Harness 端