Skip to content

feat: implement web search tool with Brave Search API integration#88

Merged
hellodk merged 2 commits into
masterfrom
feat/web-search
Jul 16, 2026
Merged

feat: implement web search tool with Brave Search API integration#88
hellodk merged 2 commits into
masterfrom
feat/web-search

Conversation

@hellodk

@hellodk hellodk commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Implement a web search tool that enables the Champ agent to query the internet using the Brave Search API. This allows the agent to research external information during coding tasks.

Changes

  • New Tool: web_search tool in src/tools/web-search.ts

    • Accepts search queries and returns ranked results (title, URL, description)
    • Reads Brave API key from VS Code SecretStorage
    • Supports pagination (offset/limit) and freshness filters (past day/week/month/year)
    • Enforces max 10 results per query with default of 5
    • Handles API errors and network failures gracefully
  • Registration: Tool registered in extension.ts and available to agent

  • Testing: Comprehensive unit tests (14 tests, all passing)

    • API key validation and error handling
    • Result formatting and truncation
    • Parameter validation (count, offset, freshness)
    • Network error handling
    • Endpoint verification

Tests Passed

  • ✅ All 14 web-search tool tests pass
  • ✅ Full unit suite: 1282/1289 tests pass (2 pre-existing failures unrelated to this PR)
  • ✅ No regressions in existing functionality

Acceptance Criteria

  • ✅ Implement web-search.ts tool with Brave Search API integration
  • ✅ Tool accepts query string and returns ranked search results
  • ✅ Brave API key read from VS Code SecretStorage
  • ✅ Graceful error handling with user-friendly messages
  • ✅ Results include pagination support (offset/limit)
  • ✅ Tool registered in tool registry
  • ✅ Search results truncated to prevent token bloat (max 10, default 5)
  • ✅ Comprehensive unit tests validating all aspects

Closes #67

hellodk and others added 2 commits July 16, 2026 23:58
…oot workspaces (#58)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add web_search tool to enable agent web queries using Brave Search API
- Read API key from VS Code SecretStorage (set via 'Champ: Set Brave API Key' command)
- Support pagination (offset/limit) and freshness filters
- Enforce max 10 results per query with configurable default (5)
- Handle API errors gracefully with descriptive error messages
- Add comprehensive unit tests (14 tests, all passing)
- Register tool in extension.ts for agent availability

Closes #67

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DLSvxucbfqMjup96KyKVyE
@hellodk
hellodk merged commit d698cb9 into master Jul 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Implement web search tool with Brave Search API integration

1 participant