Initial Checks
Description
In server/mcpserver/server.py, the get_prompt handler catches all exceptions and re-raises as ValueError(str(e)) without chaining:
Line 1110-1112:
exceptExceptionase:
logger.exception(f"Error getting prompt {name}")
raiseValueError(str(e))This discards the original exception's type, traceback, and identity. Callers cannot use isinstance() or __cause__ to determine what went wrong.
The same file uses the correct pattern eight lines earlier (line 459):
raiseResourceError(f"Error reading resource {uri}") fromexcA second instance at line 451 also omits from:
exceptValueError:
raiseResourceError(f"Unknown resource: {uri}")Fix
# Line 1112raiseValueError(str(e)) frome# Line 451exceptValueErrorasexc:
raiseResourceError(f"Unknown resource: {uri}") fromexcImpact
Without from, Python shows "During handling of the above exception, another exception occurred" which is confusing. With from, it shows "The above exception was the direct cause of the following exception" and preserves __cause__ for programmatic inspection.
Initial Checks
Description
In
server/mcpserver/server.py, theget_prompthandler catches all exceptions and re-raises asValueError(str(e))without chaining:Line 1110-1112:
This discards the original exception's type, traceback, and identity. Callers cannot use
isinstance()or__cause__to determine what went wrong.The same file uses the correct pattern eight lines earlier (line 459):
A second instance at line 451 also omits
from:Fix
Impact
Without
from, Python shows "During handling of the above exception, another exception occurred" which is confusing. Withfrom, it shows "The above exception was the direct cause of the following exception" and preserves__cause__for programmatic inspection.