Skip to content

[Feat]: Add no-arg overload for getUserInput() in RequestContext to avoid passing null for default delimiter #668

@CokeLee777

Description

@CokeLee777

Is your feature request related to a problem? Please describe.

In io.a2a.server.agentexecution.RequestContext (a2a-java-sdk-server-common), the current getUserInput(String delimiter) method uses null as a signal to apply a default delimiter ("\n"). This is an unintuitive API contract that forces callers to pass null explicitly to get default behavior, which is not idiomatic Java.

// Current: caller must pass null to use default delimiter
context.getUserInput(null);

Describe the solution you'd like

Add a no-argument overload that delegates to the existing method with the default delimiter, without changing the existing signature:

public String getUserInput() {
    return getUserInput("\n");
}

This allows callers to write:

context.getUserInput();      // default "\n" delimiter
context.getUserInput(" ");  // custom delimiter

Describe alternatives you've considered

Replacing the existing method entirely with a cleaner signature that removes the null handling — this would be a breaking change and is not preferred.

Additional context

The existing Javadoc already acknowledges the awkwardness with the null example (context.getUserInput(null); // uses "\n"), which suggests this was recognized as non-ideal at the time of writing. Adding the no-arg overload is fully backward-compatible and requires minimal change.

I'd be happy to submit a PR for this if the proposal is accepted.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions