feat: add optional you.com search helper#53
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis pull request adds an optional You.com-based web search tool ( Sequence Diagram(s)sequenceDiagram
participant Client
participant MCPServer
participant YDCIndexAPI
Client->>MCPServer: ListToolsRequest
MCPServer->>MCPServer: buildToolList()
MCPServer-->>Client: tools (includes search-web if YDC_API_KEY set)
Client->>MCPServer: CallToolRequest(search-web, query, count)
MCPServer->>MCPServer: validate query, YDC_API_KEY
MCPServer->>YDCIndexAPI: searchWeb(query, count)
YDCIndexAPI-->>MCPServer: JSON search results
MCPServer-->>Client: normalized { web, news } response
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/index.ts`:
- Around line 170-174: The query parsing in src/index.ts is validating after
coercion, so String(undefined) becomes a truthy "undefined" and bypasses the
missing-query error. In the request handling logic near the query/count
extraction, first read the raw query value from request.params.arguments, check
that it is present before converting it to a string, and only then proceed with
the existing count handling and error throw in the same block.
- Around line 104-108: The You.com fetch call in the request path currently has
no timeout, so a hung network request can block the MCP server. Update the fetch
invocation in the code around the endpoint request to pass an AbortSignal
created with AbortSignal.timeout(30_000), and make sure the surrounding request
handling in the same flow correctly propagates or handles the resulting abort
error.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5a2bb5ad-a3e2-4e1e-b7bb-bcf25c511b45
⛔ Files ignored due to path filters (2)
dist/index.jsis excluded by!**/dist/**package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
README.mdsrc/index.ts
Why\nThis MCP server already helps agents extract structured data from specific pages, but there is no built-in way to discover those pages first. This adds a small optional web-search helper so an agent can find candidate URLs, then hand those URLs back to the existing extraction flow. I kept this optional and left the default behavior unchanged.\n\n## What changed\n- added an optional MCP tool backed by the You.com Search API\n- only advertise the tool when is configured\n- documented setup for the additional env var and a basic usage example\n\n## Setup\n- stays required for \n- enables \n\n## Usage example\n\n\n## Validation\n-