Skip to content

Allow custom or numeric request ID generation (Snowflake MCP server rejects string IDs) #703

@manasnilorout

Description

@manasnilorout

Expected Behavior

The Java SDK should provide a way to configure how request IDs are generated. This could include:

  • A public interface or callback for supplying a custom RequestIdGenerator.
  • Configuration options to choose between UUID-based, string-based, or numeric-only IDs.

This would help support MCP servers that require strict numeric IDs or forbid UUID/string-based request IDs.

Current Behavior

Currently, the Java SDK:

  • Uses a private generateRequestId() method.
  • Uses an internal private counter.
  • Produces UUID-counter formatted IDs like "62d0970d-0".
  • Provides no public extension point to override or customize ID generation.

This causes compatibility issues with MCP servers (such as Snowflake's MCP implementation) that accept only numeric IDs.

Example (hypothetical API):

McpClient client = McpClient.builder()
    .withRequestIdGenerator(() -> String.valueOf(counter.incrementAndGet()))
    .build();

Context

When integrating with the Snowflake MCP server, requests are rejected because the Java SDK always generates UUID-based IDs.

Workarounds include:

  • Implementing a custom transport such as SimpleHttpTransport.
  • Remapping request and response IDs manually.

These solutions work but duplicate SDK logic and introduce unnecessary complexity. Providing a built-in, configurable ID generation mechanism would make the SDK more flexible and easier to use.

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