Skip to content

Validation response for invalid request - WrapBusinessError vs JsonRPC #496

@sabob

Description

@sabob

Hi all,

When using Jakarta Validation on a tool method parameter, the response differs based on the presence of @WrapBusinessError.

Example:

@Tool
foo(FooRequest request)

class FooRequest {
    @NotBlank
    private String sessionId;
}

With @WrapBusinessError:

{
  "content": [
    {
      "type": "text",
      "text": "io.quarkiverse.mcp.server.McpException: chat.request.sessionId: must not be blank"
    }
  ],
  "isError": true
}

Without @WrapBusinessError:


{
  "error": "MCP error -32602: chat.request.sessionId: must not be blank"
}

I've also included the (MCP Server - Hibernate Validator dependency.

Is this expected response?

Is the 2nd response viewed as a Protocol error and with @WrapBusinessError is a Tool error?

Kind regards

Bob

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-feedbackPull requests that update Java code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions