Skip to content

Fix the parameters order problems when invoke in MCP Inspector v0.12.0 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

steveGuRen
Copy link
Contributor

@steveGuRen steveGuRen commented May 14, 2025

There are problems when invoke in MCP Inspector page, the parameters order show in page is error. And it cause the annotation not work correct when call method.invoke()
image

Copy link

codecov bot commented May 15, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@codeboyzhou codeboyzhou self-assigned this May 15, 2025
@codeboyzhou codeboyzhou changed the title fix the parameters order problems when invode in MCP Inspector v0.12.… Fix the parameters order problems when invoke in MCP Inspector v0.12.0 May 15, 2025
@codeboyzhou codeboyzhou added the bug Something isn't working label May 15, 2025
@codeboyzhou
Copy link
Owner

@steveGuRen
Thank you, I reproduced this issue, will review the PR code later.

@steveGuRen
Copy link
Contributor Author

@steveGuRen Thank you, I reproduced this issue, will review the PR code later.

It's a good news.

Copy link
Owner

@codeboyzhou codeboyzhou left a comment

Choose a reason for hiding this comment

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

Finished my review. By the way, could you please amend the commit message to avoid the typo? I have edited the title of this PR but can not amend your commit, thanks.

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
Copy link
Owner

Choose a reason for hiding this comment

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

Wildcard imports are not recommended because they might introduce potential issues such as naming conflicts or reduced code clarity.

Method[] methods = clazz.getMethods();
return Set.of(methods).stream().filter(m -> m.isAnnotationPresent(annotation)).collect(toSet());
List<Method> methodList = Arrays.asList(methods);
return methodList.stream().filter(p -> p.isAnnotationPresent(annotation)).toList();
Copy link
Owner

Choose a reason for hiding this comment

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

How about changing them to this? It looks more concise.
return Stream.of(methods).filter(m -> m.isAnnotationPresent(annotation)).toList();

Parameter[] parameters = method.getParameters();
return Set.of(parameters).stream().filter(p -> p.isAnnotationPresent(annotation)).collect(toSet());
List<Parameter> parameterList = Arrays.asList(parameters);
return parameterList.stream().filter(p -> p.isAnnotationPresent(annotation)).toList();
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above, more concise.
return Stream.of(parameters).filter(p -> p.isAnnotationPresent(annotation)).toList();

@codeboyzhou codeboyzhou added the waiting for user Waiting for user feedback or more details label May 18, 2025
@codeboyzhou codeboyzhou added this to the v0.4.0 milestone May 18, 2025
@codeboyzhou codeboyzhou linked an issue May 18, 2025 that may be closed by this pull request
@steveGuRen steveGuRen force-pushed the fix-parameter-order-problems branch from 05038e3 to 3acfc9d Compare May 19, 2025 01:31
@steveGuRen
Copy link
Contributor Author

@codeboyzhou all problems fixed.You can review again.

@codeboyzhou codeboyzhou merged commit ea483cc into codeboyzhou:main May 19, 2025
3 checks passed
@codeboyzhou
Copy link
Owner

@steveGuRen LGTM, merged, thanks for your contribution, this fix will be included in v0.4.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for user Waiting for user feedback or more details
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The parameters order problems when invoke in MCP Inspector v0.12.0
2 participants