Surface AskBill sources in search_documentation MCP tool#29
Merged
Conversation
The AskBill websocket service returns both `answer` and `sources`, but the handler was only forwarding `answer`. Without citations, callers (and the LLMs consuming this tool) have no way to verify URLs the answer text mentions — in practice, hallucinated links slip through unchallenged. Append a `## Sources` section to the response, formatted from the `SourceMetadata` shape (title, url) defined in finn-mvp. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…g whitespace - Escape `\`, `[`, `]` in source titles so titles like "Auth [v2]" don't break the rendered markdown link. - Wrap URLs in angle brackets (`<url>`) so URLs containing parens (e.g. Wikipedia's `Plaid_(company)`) still render correctly. - `rstrip()` the answer before appending the Sources section so trailing newlines in the AskBill response don't produce 3+ blank lines. - Add a docstring to `_format_sources` to match the rest of the file. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The `[tool.pytest]` section was non-canonical (should be `[tool.pytest.ini_options]`) and `python_files` was a bare string instead of a list. Older pytest tolerated both; newer pytest (9.x) hard-fails: TypeError: pyproject.toml: config option 'python_files' expects a list for type 'args', got str: 'test_*.py' Last green CI run was October 2025 against pytest 8.x; this PR is the first run since pytest 9 made it into the environment. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
search_documentationMCP tool was discarding thesourcesarray returned by the AskBill websocket and only forwardinganswer.plaid.com/docs/account/plans/#trialURL with no way to verify.## Sourcessection to the response, formatted from theSourceMetadatashape (title,url) defined inplaid/finn-mvp:message_types.py. URLs are deduplicated; sources with neither URL nor title are skipped.\,[,]) and URLs use the<url>autolink form so titles likeAuth [v2]and URLs containing parens (e.g.Plaid_(company)) render correctly. The answer isrstrip()ed before the Sources section to avoid stacked blank lines.Drive-by: pytest config fix
CI was failing on a pre-existing latent bug in
sandbox/pyproject.toml:[tool.pytest]should be[tool.pytest.ini_options], andpython_filesmust be a list, not a bare string. Older pytest tolerated both; pytest 9 hard-fails:Last green CI was Oct 2025 (pytest 8.x); this PR was the first run since pytest 9 entered the environment, so it tripped here. Fix is in its own commit (
Fix pytest config in pyproject.toml) so it's reviewable on its own — happy to split into a separate PR if preferred.Verification
Ran the local checkout end-to-end against the real AskBill websocket (Claude Code MCP config swapped from
uvx mcp-server-plaidtouv run --directory <local-clone> mcp-server-plaid):plaid.com/docs/account/plans/#trialnow appends a## Sourcessection with four realsupport.plaid.com/hc/en-us/articles/...URLs returned by AskBill's retrieval — confirming the prior link was an LLM hallucination with no source backing it.Test plan
## Sourcessection appears with clickable links[]; not yet observed in practice🤖 Generated with Claude Code