Summary
While using chat-langchain, the docs search tool returned a stale/broken docs URL in its search results. This suggests URLs constructed from the Mintlify API are not being validated before being returned to the agent and recorded in tracing.
Related to #530, #531.
Evidence (what I saw)
Query / intent
- “what is langchain prompt”
- “langchain.chains”
Stale URL returned
Observed behavior
- The returned URL appears stale (leads to a not-found experience / broken destination), yet it was surfaced as a search result.
Root cause (likely)
_format_search_results() builds full URLs from Mintlify API paths and returns them without validation.
There is already a purpose-built URL validator:
_check_urls_async() in link_check_tools.py
…but it does not appear to be called anywhere in the search pipeline, so stale URLs can pass through.
Proposed fix
In _format_search_results() (after building the list of URLs):
- Call
_check_urls_async() on the constructed URLs.
- Filter out any URLs that return 404 or soft-404.
- Return only validated URLs to:
- the agent/tool response
- LangSmith tracking/tracing outputs
Why this is complementary to existing work
Acceptance criteria
- Search results returned from the docs search tool do not include URLs that are 404 or soft-404.
- Valid URLs continue to be returned unchanged.
- Tests cover a mixed set of valid + stale URLs and verify stale URLs are filtered before results are returned.
Maintainer approval request
If this approach looks correct, can a maintainer please confirm it’s approved so I can open a PR implementing exactly this?
Summary
While using chat-langchain, the docs search tool returned a stale/broken docs URL in its search results. This suggests URLs constructed from the Mintlify API are not being validated before being returned to the agent and recorded in tracing.
Related to #530, #531.
Evidence (what I saw)
Query / intent
Stale URL returned
Observed behavior
Root cause (likely)
_format_search_results()builds full URLs from Mintlify API paths and returns them without validation.There is already a purpose-built URL validator:
_check_urls_async()inlink_check_tools.py…but it does not appear to be called anywhere in the search pipeline, so stale URLs can pass through.
Proposed fix
In
_format_search_results()(after building the list of URLs):_check_urls_async()on the constructed URLs.Why this is complementary to existing work
Acceptance criteria
Maintainer approval request
If this approach looks correct, can a maintainer please confirm it’s approved so I can open a PR implementing exactly this?