Skip to content

Fix: McpAsyncClient#listTools prevent infinite recursion#631

Merged
tzolov merged 2 commits into
modelcontextprotocol:mainfrom
leehaut:hotfix-lance-4700
Oct 30, 2025
Merged

Fix: McpAsyncClient#listTools prevent infinite recursion#631
tzolov merged 2 commits into
modelcontextprotocol:mainfrom
leehaut:hotfix-lance-4700

Conversation

@leehaut

@leehaut leehaut commented Oct 23, 2025

Copy link
Copy Markdown
Contributor

This PR fixes a pagination issue in McpAsyncClient#listTools().

Previously, the method only checked for null when expanding pages:

.expand(result -> (result.nextCursor() != null) ? this.listTools(result.nextCursor()) : Mono.empty())

If nextCursor was an empty string (""), the method would still recursively call listTools(""), potentially causing unexpected behavior or infinite recursion.

…ty string

Signed-off-by: lance <leehaut@gmail.com>
Signed-off-by: lance <leehaut@gmail.com>
@tzolov tzolov self-assigned this Oct 30, 2025

@tzolov tzolov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks @leehaut

@tzolov tzolov added this to the 0.15.0 milestone Oct 30, 2025
@tzolov tzolov merged commit e91fe7f into modelcontextprotocol:main Oct 30, 2025
1 check passed
@leehaut leehaut deleted the hotfix-lance-4700 branch October 30, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants