Repository navigation
Chat example: opt-in Parallel MCP lookup with source cards #484
georgeatparallel
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The Chat Example could show inspectable sources alongside a cited answer by adding an opt-in Parallel MCP search provider and rendering its result titles and original URLs as source cards.
I'm contributing on behalf of Parallel. This proposal was prepared with AI assistance.
The Chat Example README already describes web search as part of its live-data workflow. At that revision,
webSearchreturns only{ content: text }. The tool display exposes results as expandable raw output. It doesn't render structured source cards, so source visibility depends on the generated text.For a prompt such as "Find the official json-render Chat Example documentation and explain how it streams UI," the proposed behavior would be an answer citing retrieved pages, plus cards linking directly to those pages as soon as search output reaches the chat stream.
The change would stay within
examples/chat:CHAT_SEARCH_PROVIDER=parallelsetting. Leaving it unset would keep the current search provider and behavior. Removing it would restore that default.webSearchtool seam inlib/tools/search.tswith an HTTP MCP client for Unified MCPweb_search. Use its goal and keyword-query schema, normalize excerpts and{ title, url }sources, and have the existing agent cite those URLs. Anonymous search is available at lower rate limits, as documented in Parallel MCP setup. The chat agent would still require its existing AI Gateway setup.lib/agent.tsandapp/api/generate/route.tsto manage the opt-in client's lifetime within the existing route budget. Keep rate limiting and search error handling, and send ajson-render-chatUser-Agent on Parallel requests. Keep credentials scoped to their respective services.app/page.tsx, preserving message order alongside text and spec patches. Use returned titles and original HTTP(S) URLs, deduplicate links, and treat titles as text. Update.env.example, the README, and dependency manifests as needed.I checked the repository's issues, PRs, and Discussions and found no matching search-provider or source-card proposal. I also ran a standalone anonymous MCP feasibility check: initialization, tool discovery, and
web_searchsucceeded with ajson-render-chatUser-Agent and no authorization header. The search returned 10 results with titles, URLs, and excerpts, including the Chat Example README; its original GitHub URL returned HTTP 200. This check did not run the chat integration.Implementation validation would cover unchanged default behavior, an opt-in cited answer through
/api/generate, source cards appearing when tool output arrives, safe and duplicate URLs, MCP cleanup, and rate-limit, timeout, and search failures. It would also run the example's documented type and build checks and the repository's type check.Would this scoped addition fit the Chat Example?
All reactions