词元之母TOK.MOM - 平台充值汇率 1:1 即 1 人民币充值到账 1 美元,支持一个 Key 调用近 600+ 海内外模型,限时特价模型低至 1 折,欢迎上岸!
| 工具 | 激活条件 |
|---|---|
websearch | 使用 OpenCode Zen 托管模型 或 设置 OPENCODE_ENABLE_EXA=true |
codesearch | 使用 OpenCode Zen 托管模型 或 设置 OPENCODE_ENABLE_EXA=true |
batch | 配置 experimental.batch_tool: true |
lsp | 启用 OPENCODE_EXPERIMENTAL_LSP_TOOL 标志 |
plan_enter / plan_exit | CLI 模式 + 实验性计划模式标志 |
opencode.json 中配置:{
"experimental": {
"batch_tool": true
}
}{
"$schema": "https://opencode.ai/config.json",
"tools": {
"write": false,
"bash": false,
"webfetch": true
}
}{
"$schema": "https://opencode.ai/config.json",
"tools": {
"write": true,
"bash": true
},
"agent": {
"plan": {
"tools": {
"write": false,
"bash": false
}
}
}
}{
"tools": {
"bash": true
}
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
command | string | ✅ | 要执行的命令 |
description | string | ✅ | 命令描述(5-10 个词) |
workdir | string | ❌ | 工作目录,默认项目根目录 |
timeout | number | ❌ | 超时时间(毫秒),默认 120000(2 分钟) |
cd、rm、cp、mv、mkdir、touch、chmod、chown、cat 等命令external_directory 权限确认{
"tools": {
"edit": true
}
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
filePath | string | ✅ | 文件绝对路径 |
oldString | string | ✅ | 要替换的原始文本 |
newString | string | ✅ | 替换后的文本(必须与 oldString 不同) |
replaceAll | boolean | ❌ | 是否替换所有匹配(默认 false) |
{
"tools": {
"write": true
}
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
filePath | string | ✅ | 文件绝对路径(必须是绝对路径) |
content | string | ✅ | 要写入的内容 |
{
"tools": {
"read": true
}
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
filePath | string | ✅ | 文件或目录的绝对路径 |
offset | number | ❌ | 从第几行/条开始读(1-indexed,从 1 开始计数) |
limit | number | ❌ | 最多读多少行/条(默认 2000) |
DEFAULT_READ_LIMIT)MAX_LINE_LENGTH)MAX_BYTES)/ 结尾offset 和 limit 分页(与文件读取一致,1-indexed)<path>/Users/xxx/project/src</path>
<type>directory</type>
<entries>
components/
utils/
index.ts
(3 entries)
</entries>{
"tools": {
"grep": true
}
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
pattern | string | ✅ | 正则表达式模式 |
path | string | ❌ | 搜索 路径,默认当前目录 |
include | string | ❌ | 文件过滤模式,如 "*.ts" |
{
"tools": {
"glob": true
}
}| 模式 | 说明 | 示例 |
|---|---|---|
* | 匹配任意字符(不含 /) | *.ts |
** | 匹配任意目录层级 | src/**/*.ts |
? | 匹配单个字符 | file?.ts |
[abc] | 匹配指定字符 | file[123].ts |
{a,b} | 匹配多个模式 | *.{ts,tsx} |
{
"tools": {
"list": true
}
}{
"tools": {
"patch": true
}
}{
"tools": {
"multiedit": true
}
}{
"tools": {
"skill": true
}
}{
"tools": {
"todowrite": true
}
}{
"tools": {
"todoread": true
}
}{
"tools": {
"question": true
}
}你:帮我重构这个模块
AI:我注意到有几种重构方式,请问你更倾向哪种?
○ 提取为独立函数
○ 拆分成多个类
○ 保持结构 ,只优化命名
[输入自定义答案]todowrite 和 todoread 工具在 subagent 中默认禁用,但 question 工具默认启用。{
"tools": {
"webfetch": true
}
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
url | string | ✅ | 要获取的 URL(必须以 http:// 或 https:// 开头) |
format | string | ❌ | 返回格式:markdown(默认)、text、html |
timeout | number | ❌ | 超时秒数(最大 120 秒,默认 30 秒) |
format: "markdown" - HTML 自动转为 Markdownformat: "text" - 提取纯文本,去除 script/style 标签format: "html" - 返回原始 HTML{
"tools": {
"websearch": true
}
}需要设置环境变量 OPENCODE_ENABLE_EXA=true 或使用 OpenCode Zen 托管模型。
{
"tools": {
"codesearch": true
}
}