Class McpApplicationErrorException

All Implemented Interfaces:
ToolErrorVisibleToLlm, Serializable

public class McpApplicationErrorException extends LlmVisibleToolExecutionException
An error that an MCP server reported inside an otherwise successful tool result, by setting isError to true. The MCP specification calls this a "Tool Execution Error" and defines it as the way a server tells the model that a tool did not succeed, as opposed to a protocol error, which indicates that the call itself went wrong.

Because the text of such an error is written by the server for the model, this exception implements ToolErrorVisibleToLlm: error handlers that honor that interface send the text to the LLM instead of failing the AI Service invocation.

It is a ToolExecutionException, so code that catches that type catches this one too, while catching this type distinguishes an application-level error from a protocol error.

Since:
1.21.0
See Also:
  • Constructor Details

    • McpApplicationErrorException

      public McpApplicationErrorException(String message)