Skip to content

Report docs search tool errors - #70

Merged
ivpusic merged 2 commits into
mainfrom
fix-docs-search-errors
Nov 20, 2026
Merged

ivpusic merged 2 commits into
mainfrom
fix-docs-search-errors

Conversation

@ivpusic

@ivpusic ivpusic commented Nov 20, 2026

Copy link
Copy Markdown
Member

dune docs search now fails with the server's message when the docs MCP tool returns an error. Before, it printed the error text as a search result and exited 0. Follow-up from Norbert's review of #67.

Impact

  • docs search only. An error result (IsError: true) now returns searching docs: <text> and a non-zero exit, in text and JSON output alike.

Context for reviewers

  • TestSearchToolError fails on main and passes here. The test server helper now takes a whole CallToolResult, so it can return an error result.

  • No visual surface: CLI change with no rendered UI; verified with unit tests (go vet ./..., go test -race ./...).

A failed search_dune_docs call comes back as a result with IsError set.
docs search parsed its error text as a search result and exited 0; it
now returns the error.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1f46d-4de8-7404-a66a-7e2a8be6632a
Co-authored-by: Amp <amp@ampcode.com>

@norbertdurcansk norbertdurcansk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with suggestions. The fix is right: a tool error result now fails the command instead of being printed as a search result with exit 0. TestSearchToolError checks both the error message and that nothing was printed as results, so it would catch a regression.

(Reviewed by reading the code on 763c567; I didn't re-run the tests locally.)

Comment thread cmd/docs/search.go Resolved
Comment thread cmd/docs/search.go Resolved
dunemcp.ToolError is the error path of dunemcp.Result, so docs search
reports a tool error the same way the other MCP commands do: text
blocks joined by newlines, no trailing period, and a message naming
the tool when there is no text.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1f46d-4de8-7404-a66a-7e2a8be6632a
Co-authored-by: Amp <amp@ampcode.com>
@ivpusic
ivpusic merged commit 2989deb into main Nov 20, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants