Class McpApplicationErrorException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
dev.langchain4j.exception.LangChain4jException
dev.langchain4j.exception.ToolExecutionException
dev.langchain4j.exception.LlmVisibleToolExecutionException
dev.langchain4j.mcp.client.McpApplicationErrorException
- All Implemented Interfaces:
ToolErrorVisibleToLlm, Serializable
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 Summary
Constructors -
Method Summary
Methods inherited from class LlmVisibleToolExecutionException
messageForLlmMethods inherited from class ToolExecutionException
errorCodeMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
McpApplicationErrorException
-