Native Tools
OpenHuman 内置了一套原生工具,开箱即用,无需额外配置。
文件操作
file_read
读取文件内容:
const content = await client.tools.execute('file_read', {
path: './src/index.js',
});
file_write
写入文件:
await client.tools.execute('file_write', {
path: './new-file.js',
content: 'console.log("hello");',
});
edit_file
精确替换文件内容:
await client.tools.execute('edit_file', {
path: './src/index.js',
oldString: 'const old = true;',
newString: 'const new = false;',
});
glob_search
按模式搜索文件:
const files = await client.tools.execute('glob_search', {
pattern: '**/*.js',
});
Git 操作
git_operations
执行 Git 操作:
await client.tools.execute('git_operations', {
command: 'status',
});
支持的命令:status、log、diff、blame、branch
开发工具
run_linter
运行项目 linter:
const result = await client.tools.execute('run_linter', {
fix: false,
});
run_tests
运行测试:
const result = await client.tools.execute('run_tests', {
pattern: 'tests/**/*.test.js',
});
网络工具
http_request
发送 HTTP 请求:
const response = await client.tools.execute('http_request', {
url: 'https://api.example.com/data',
method: 'GET',
});
web_search
搜索网页:
const results = await client.tools.execute('web_search', {
query: 'OpenHuman AI 最新动态',
max_results: 5,
});
web_scraper
抓取网页内容:
const content = await client.tools.execute('web_scraper', {
url: 'https://example.com/article',
});
系统工具
bash
执行 shell 命令:
await client.tools.execute('bash', {
command: 'ls -la',
});
process_list
列出运行中的进程:
const processes = await client.tools.execute('process_list', {});
记忆工具
memory_recall
检索记忆:
const memories = await client.tools.execute('memory_recall', {
query: '用户偏好',
});
memory_store
存储记忆:
await client.tools.execute('memory_store', {
content: '用户喜欢简洁设计',
tags: ['preference'],
});
下一步
- Coder - 代码工具详解
- 记忆工具 - 记忆工具详解
- Web Search - 搜索工具详解