Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/tools/web-fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ web_fetch(url="https://github.com/google/gemini-react/blob/main/README.md", prom
- **Content processing:** The tool fetches content directly and processes it using an AI model, converting HTML to readable text format.
- **Output quality:** The quality of the output will depend on the clarity of the instructions in the prompt.
- **MCP tools:** If an MCP-provided web fetch tool is available (starting with "mcp\_\_"), prefer using that tool as it may have fewer restrictions.
- **Proxy support:** The tool will use a configured proxy if available. Additionally, when `GEMINI_SANDBOX_PROXY_COMMAND` is set, the tool will automatically use the sandbox proxy which listens on `http://localhost:8877`.
7 changes: 7 additions & 0 deletions packages/core/src/tools/web-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,16 @@ export class WebFetchTool extends BaseDeclarativeTool<
type: 'object',
},
);

// Use the configured proxy if available
const proxy = config.getProxy();
if (proxy) {
setGlobalDispatcher(new ProxyAgent(proxy as string));
}
// If no configured proxy, check if sandbox proxy is set via GEMINI_SANDBOX_PROXY_COMMAND
else if (process.env['GEMINI_SANDBOX_PROXY_COMMAND']) {
// When GEMINI_SANDBOX_PROXY_COMMAND is set, the proxy listens on localhost:8877
setGlobalDispatcher(new ProxyAgent('http://localhost:8877'));
}
}

Expand Down