fix(tools): enable web_fetch by default

This commit is contained in:
Peter Steinberger
2026-01-15 07:42:01 +00:00
parent f5577ad78e
commit 081e5ef572
5 changed files with 29 additions and 6 deletions

View File

@@ -29,6 +29,7 @@
- Browser: add tests for snapshot labels/efficient query params and labeled image responses.
- macOS: ensure launchd log directory exists with a test-only override. (#909) — thanks @roshanasingh4.
- macOS: format ConnectionsStore config to satisfy SwiftFormat lint. (#852) — thanks @mneves75.
- Tools: enable `web_fetch` by default (unless explicitly disabled in config).
- Packaging: run `pnpm build` on `prepack` so npm publishes include fresh `dist/` output.
- Telegram: register dock native commands with underscores to avoid `BOT_COMMAND_INVALID` (#929, fixes #901) — thanks @grp06.
- Google: downgrade unsigned thinking blocks before send to avoid missing signature errors.

View File

@@ -613,7 +613,7 @@ Gateway process.
Notes:
- If you use allowlists, add `web_search`/`web_fetch` or `group:web`.
- In sandboxed sessions, `web_fetch` auto-enables unless explicitly disabled.
- `web_fetch` is enabled by default (unless explicitly disabled).
- Daemons read env vars from `~/.clawdbot/.env` (or the service environment).
Docs: [Web tools](/tools/web).

View File

@@ -22,7 +22,7 @@ These are **not** browser automation. For JS-heavy sites or logins, use the
- Results are cached by query for 15 minutes (configurable).
- `web_fetch` does a plain HTTP GET and extracts readable content
(HTML → markdown/text). It does **not** execute JavaScript.
- In sandboxed sessions, `web_fetch` is enabled automatically (unless explicitly disabled).
- `web_fetch` is enabled by default (unless explicitly disabled).
## Getting a Brave API key
@@ -48,7 +48,7 @@ Search the web with Braves API.
### Requirements
- `tools.web.search.enabled: true`
- `tools.web.search.enabled` must not be `false` (default: enabled)
- Brave API key (recommended: `clawdbot configure --section web`, or set `BRAVE_API_KEY`)
### Config
@@ -80,7 +80,7 @@ Fetch a URL and extract readable content.
### Requirements
- `tools.web.fetch.enabled: true`
- `tools.web.fetch.enabled` must not be `false` (default: enabled)
### Config

View File

@@ -0,0 +1,23 @@
import { describe, expect, it } from "vitest";
import { createWebFetchTool, createWebSearchTool } from "./web-tools.js";
describe("web tools defaults", () => {
it("enables web_fetch by default (non-sandbox)", () => {
const tool = createWebFetchTool({ config: {}, sandboxed: false });
expect(tool?.name).toBe("web_fetch");
});
it("disables web_fetch when explicitly disabled", () => {
const tool = createWebFetchTool({
config: { tools: { web: { fetch: { enabled: false } } } },
sandboxed: false,
});
expect(tool).toBeNull();
});
it("enables web_search by default", () => {
const tool = createWebSearchTool({ config: {}, sandboxed: false });
expect(tool?.name).toBe("web_search");
});
});

View File

@@ -99,8 +99,7 @@ function resolveSearchEnabled(params: { search?: WebSearchConfig; sandboxed?: bo
function resolveFetchEnabled(params: { fetch?: WebFetchConfig; sandboxed?: boolean }): boolean {
if (typeof params.fetch?.enabled === "boolean") return params.fetch.enabled;
if (params.sandboxed) return true;
return false;
return true;
}
function resolveSearchApiKey(search?: WebSearchConfig): string | undefined {