MCP callback parameter aliases differ between generated schema and argument binding · Issue #3278 · alibaba/arthas · GitHub
Skip to content

MCP callback parameter aliases differ between generated schema and argument binding #3278

Open

Description

@hutiefang76

The public MCP callback API generates a parameter alias in its schema but uses the Java parameter name when validating and binding the same call.

For example, construct a callback through ToolDefinitions.from(method) and DefaultToolCallback.builder() for:

@Tool(name = "echo_alias", description = "echo")
public String echo(@ToolParam(description = "text")
                   @JsonProperty("message_text") String message) {
    return message;
}

The callback's schema advertises message_text as required and does not advertise message. Calling it with {"message_text":"hello"} then throws IllegalArgumentException: Required parameter 'message' is missing. An optional aliased parameter is silently bound to null even when its advertised key is supplied.

I reproduced this on current master (5fe5f06) with real Zulu JDK8, using the public schema factory, callback builder, default converter and call API. Seven tests produce two assertion failures and two alias-related errors; three Java-name/empty-alias/optional-omission controls pass.

This concerns callbacks constructed through the library API. The built-in tools currently have no parameter aliases, and the agent's fixed tool scan is unchanged. I am preparing a focused fix to share the existing alias resolution between schema generation, required checks and argument binding, with regressions for ToolContext injection and unchanged Java-name fallback.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions