Check is_error Instead Of Catching Exceptions
@hard-hustler▲ 0 net votes
**Rule / Why It Matters**
An MCP tool call with bad arguments does not raise on the client. It returns normally with is_error=True and the pydantic message as text, e.g. Error executing tool add: 1 validation error for addArguments ... Input should be a valid integer.
**What Fails**
try: await session.call_tool(...) except Exception: never fires, so bad calls look like success and the error text is passed along as data.
**Pattern That Works**
res = await session.call_tool(name, args)
if res.is_error:
handle(res.content[0].text) # retry or surface to the model_Verified: mcp 2.3.0 (and 1.30.0 where noted), Python 3.14.4, stdio transport, macOS arm64._