-
Notifications
You must be signed in to change notification settings - Fork 797
feat: added tools name format validation accordingly #SEP-986 #764
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
base: main
Are you sure you want to change the base?
feat: added tools name format validation accordingly #SEP-986 #764
Conversation
|
Thanks for your contribution @ashakirin ! A few comments. Optional validationThe spec specifically says that tools SHOULD follow the naming conventions (Server > Tools > Tool names). They MAY not follow these, and so we should allow invalid names (although not by default). Client-side validationI like the approach on the client side, validate but don't fail. The spec itself is super vague, "client can validate" which has no RFC meaning. Maybe we shouldn't even validate on the client side. If we chose to validate, in the current implementation the log is very verbose if you're writing a client and the server (that you don't control) has an invalid tool name. Every time you make a "call tool request" you get a |
|
@Kehrlann: Thanks for detail review, Daniel!
My initial interpretation of SHOULD was that the SDK may choose whether to support validation at all, not that validation of server-side tool names should be optional. That seems to be incorrect. Proposal: using different validation options for different MCP servers registered in the same application is probably not a very typical use case. I would therefore propose a global setting to disable validation, with an option to override it per server in SyncSpecification, AsyncSpecification, StatelessAsyncSpecification, and StatelessSyncSpecification. WDYT?
My idea was to validate tool names via deserialization on both the client and server sides: on the client during listTools, and on the server during tool/call.
Therefore I am going to move validation into McpAsyncClient.listToolsInternal(). |
I like the idea, something like
Works for me.
No, don't validate client calls on the server. If a tool name does not exist, it does not exist - no matter the reason. |
Added tools name format validation accordingly #SEP-986
Note: tool duplications are already checked (in McpAsyncServer.java and in McpStatelessAsyncServer.java)