All tool adapters support the same configuration options:
Copy
Ask AI
import { createBrowserTool } from '@morphllm/morphsdk/tools/browser/anthropic';const { tool, execute } = createBrowserTool({ apiKey: "YOUR_API_KEY", // Optional if using env var model: 'morph-computer-use-v1', // Default model (see options below) maxSteps: 20, // Default max steps apiUrl: 'https://browser.morphllm.com' // Override API URL});
const result = await execute({ task: "Log in with x_user and x_pass and verify dashboard", url: "https://myapp.com/login", auth: { username: "test@example.com", password: "secret123" }});
Supports username/password, per-domain credentials, and cookies. See direct execution docs for details.
If you’re currently using direct execution and want to try tools:Before (direct execution):
Copy
Ask AI
import { MorphClient } from '@morphllm/morphsdk';const morph = new MorphClient({ apiKey: "YOUR_API_KEY" });const result = await morph.browser.execute({ task: "Test checkout flow", url: "https://myapp.com", maxSteps: 20});
After (as tool):
Copy
Ask AI
import { createBrowserTool } from '@morphllm/morphsdk/tools/browser/anthropic';const { tool, execute } = createBrowserTool({ apiKey: "YOUR_API_KEY"});// Add to your agent's tools arraytools: [tool, /* other tools */]// Agent will call when needed
Browser tools use a different pattern ({ tool, execute }) than other Morph tools. Use createBrowserTool() directly with the apiKey option, or use morph.browser.execute() for direct execution.