-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix the parameters order problems when invoke in MCP Inspector v0.12.0 #2
Conversation
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 ☂️ |
@steveGuRen |
It's a good news. |
There was a problem hiding this 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.*; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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();
05038e3
to
3acfc9d
Compare
@codeboyzhou all problems fixed.You can review again. |
@steveGuRen LGTM, merged, thanks for your contribution, this fix will be included in v0.4.0 release. |
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()
