Package io.openliberty.mcp.tools
Class ToolCallUnauthorizedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.openliberty.mcp.tools.ToolCallUnauthorizedException
- All Implemented Interfaces:
Serializable
Indicates that the caller is not authorized to invoke a
Tool method.
If a method annotated with Tool throws a ToolCallUnauthorizedException then the
framework returns an HTTP 403 Forbidden response to the client, in the same way as when the
framework-level authorization check (via @DenyAll, @RolesAllowed, etc.) fails.
The HTTP response body will contain the exception message as plain text
(Content-Type: text/plain); no JSON-RPC envelope is included.
This allows application code to perform fine-grained authorization checks inside a @Tool
method body and signal an authorization failure using the standard HTTP 403 status code.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionToolCallUnauthorizedException(String message) Creates a newToolCallUnauthorizedExceptionwith the given message.ToolCallUnauthorizedException(String message, Throwable cause) Creates a newToolCallUnauthorizedExceptionwith the given message and cause.Creates a newToolCallUnauthorizedExceptionwith the given cause. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ToolCallUnauthorizedException
Creates a newToolCallUnauthorizedExceptionwith the given message.- Parameters:
message- a description of why authorization failed
-
ToolCallUnauthorizedException
Creates a newToolCallUnauthorizedExceptionwith the given message and cause.- Parameters:
message- a description of why authorization failedcause- the underlying cause
-
ToolCallUnauthorizedException
Creates a newToolCallUnauthorizedExceptionwith the given cause.- Parameters:
cause- the underlying cause
-