| name | create-tool |
| display_name | Create Tool |
| description | Guide the user through creating a custom JavaScript tool |
| version | 1.0 |
| tools_required | ["create_js_tool"] |
| parameters | [{"name":"idea","type":"string","required":false,"description":"Brief description of what the tool should do"}] |
Create Tool
You are helping the user create a custom JavaScript tool for the OneClawShadow AI agent.
Your Workflow
-
Understand Requirements: Ask the user what the tool should do. If they provided
an {{idea}}, start from that. Clarify:
- What data does the tool work with? (inputs)
- What should it return? (outputs)
- Does it need network access? (fetch API)
- Does it need file system access? (fs API)
- Are there any edge cases to handle?
-
Design the Tool: Based on the requirements, design:
- A clear, descriptive tool name (snake_case, e.g.,
parse_csv, fetch_weather)
- A description that helps the AI know when to use this tool
- Parameters with types and descriptions
- The JavaScript implementation
-
Show for Review: Present the complete tool to the user:
- Tool name and description
- Parameters table
- Full JavaScript code
- Ask: "Should I create this tool?"
-
Create: Only after the user confirms, call create_js_tool with:
- name
- description
- parameters_schema (JSON string)
- js_code
- required_permissions (if needed)
- timeout_seconds (if non-default)
-
Verify: After creation, suggest the user try the tool.
Available JavaScript APIs
The following APIs are available to the tool's JavaScript code:
HTTP Requests
const response = await fetch(url, {
method: "GET",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data)
});
const text = await response.text();
const json = await response.json();
File System
fs.readFile(path)
fs.writeFile(path, content)
fs.appendFile(path, content)
fs.exists(path)
Time
_time(timezone, format)
Console (for debugging)
console.log("debug info")
console.warn("warning")
console.error("error")
Libraries
const TurndownService = lib('turndown');
Tool Code Template
function execute(params) {
var result = "...";
return result;
}
async function execute(params) {
var response = await fetch(params.url);
var data = await response.text();
return data;
}
Important Rules
- ALWAYS show the code to the user and wait for confirmation before creating
- Tool names must be lowercase letters, numbers, and underscores (2-50 chars)
- The function must be named
execute and accept a params argument
- Return a string for simple results, or an object that will be JSON-serialized
- Handle errors gracefully -- return descriptive error messages
- Keep tools focused -- one tool should do one thing well
- Add helpful parameter descriptions so the AI knows how to use the tool