feat: add optional you.com search integration - #30
Open
mouse-value-add wants to merge 1 commit into
Open
mouse-value-add wants to merge 1 commit into
mouse-value-add wants to merge 1 commit into
Conversation
A ninth tool, you_web_search, joins the eight only when YDC_API_KEY is set — same opt-in shape as load_mcp_tools(). Plain urllib, no new dependency. Stays behind the consent gate like MCP tools; failures return as ordinary tool results so the loop routes around them. Docs in README.md and README_CN.md, incl. a keyless mcp-remote alternative; README line counts and test counts updated to match (test_core.py).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CoreCoder has no way to reach the web: when a task needs current docs, a changelog, or an error message from a newer library version than the repo pins, the agent can only guess. This adds an opt-in
you_web_searchtool so it can look things up instead.What changed
corecoder/tools/web_search.py(~80 lines) —YouWebSearchToolon the existingToolbase class, plus aweb_search_tools()loader. Plainurllib, no new dependency; the repo stays stdlib-only outside the OpenAI client.corecoder/cli.py— the loader slots in next toload_mcp_tools()(tools=[*ALL_TOOLS, *web_search_tools(), *load_mcp_tools()]), and the banner gains one line when the tool is active.tests/test_web_search.py— 8 offline tests: registration gating, schema, result formatting, 401/network error paths, count clamping, consent-gate placement.test_readme_line_counts_are_currentstays green.Design choices
YDC_API_KEYin the environment →web_search_tools()returns[]and the default eight-tool set is byte-for-byte unchanged for every existing user.READ_ONLYinpermissions.py: a query leaves the machine, so the agent asks first. In one-shot mode without--yesit's refused like any other mutating call.mcp.pytreats a dead server.execute()rather than raised,ClassVarparameters dict, ruff line length, and the README's enforced line-count bookkeeping.Setup
The model then has
you_web_search(query, count)available alongside the built-ins. If you'd rather not carry an API key at all, the README also documents the keyless alternative through the existing MCP section:{"mcpServers": {"you": {"command": "npx", "args": ["-y", "mcp-remote", "https://api.you.com/mcp?profile=free"]}}}(You.com also ships agent skills/plugins for many harnesses via youdotcom-oss/agent-skills, but for this repo the thin first-party tool felt like the right shape given the minimalism ethos.)
Validation
python -m pytest tests/ -q→ 171 passed (163 before, 8 new; all offline, mocked HTTP)ruff check corecoder tests→ cleanpython -m compileall -q corecoder tests→ cleanYDC_API_KEY,ALL_TOOLSis still exactly the 8 built-ins andweb_search_tools()is[].YDC_API_KEYin this environment). To do one:export YDC_API_KEY=<key>thencorecoder -p "search for the latest pytest release notes".Happy to adjust the shape if you'd prefer a different name, or to move the env-var read into
config.pyinstead of the loader.