fix: surface real tool errors instead of empty messages - #168
Open
royalpinto007 wants to merge 1 commit into
Open
fix: surface real tool errors instead of empty messages#168royalpinto007 wants to merge 1 commit into
royalpinto007 wants to merge 1 commit into
Conversation
Tool calls raised the underlying exception directly. When an exception had an empty string representation, such as a bare AssertionError or an error raised without a message, FastMCP formatted the response as "Error calling tool 'qdrant-find': " with nothing after the colon, so clients like Claude Desktop showed an empty error. The qdrant-store and qdrant-find tools now catch backend failures and re-raise them as ToolError with an informative, always non-empty message that includes the exception type and, when available, its message. A describe_exception helper guarantees the fallback to the class name when the message is blank. Adds regression tests that drive the tools through an in-memory FastMCP client and assert a real, non-empty error propagates.
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.
Problem
Both
qdrant-storeandqdrant-findcould surface completely empty errors inMCP clients. In Claude Desktop this looked like:
with nothing after the colon (see #151).
Root cause
The tool functions called the Qdrant connector directly and let any exception
bubble up raw. FastMCP formats a failed tool call as
Error calling tool '<name>': <str(exception)>. When the underlying exceptionhas an empty string representation, for example a bare
AssertionErroror anyerror raised without a message,
str(exception)is empty, so the clientreceives a message with an empty tail and the user has no idea what went wrong.
Fix
qdrant-storeandqdrant-findnow catch backend failures and re-raise them asToolErrorwith an always non-empty, informative message. A smalldescribe_exceptionhelper includes the exception type and its message, andfalls back to the class name when the message is blank, so an empty error can no
longer reach the client. Real messages such as "connection refused" continue to
propagate unchanged.
Tests
Adds
tests/test_error_surfacing.py, which drives both tools through anin-memory FastMCP client and asserts that a real, non-empty error propagates,
plus unit tests for the helper. Full suite passes (30 tests).
Closes #151