Describe the bug
Tools sharing the same name across different modules aren’t working, likely because of this line: https://github.com/modelcontextprotocol/ruby-sdk/blob/main/lib/mcp/server.rb#L54
To Reproduce
If your tool structure looks like this, for example
app/tools
├── application_tool.rb
├── clients
│ ├── create_tool.rb
│ ├── destroy_tool.rb
│ ├── index_tool.rb
│ ├── show_tool.rb
│ └── update_tool.rb
├── projects
│ ├── create_tool.rb
│ ├── destroy_tool.rb
│ ├── index_tool.rb
│ ├── show_tool.rb
│ └── update_tool.rb
Only the most recently registered tool remains in the tools list:
[Clients::UpdateTool, Projects::UpdateTool].to_h { |t| [t.name_value, t] }
# => {"update_tool" => Projects::UpdateTool}
This happens because name_value returns update_tool for both classes.
Expected behavior
We should probably use a more robust key here to properly handle this case. I could open a PR if needed and adapt the tests, but let me know first what you think about it!
Thanks for this gem! 🙌
Describe the bug
Tools sharing the same name across different modules aren’t working, likely because of this line: https://github.com/modelcontextprotocol/ruby-sdk/blob/main/lib/mcp/server.rb#L54
To Reproduce
If your tool structure looks like this, for example
Only the most recently registered tool remains in the tools list:
This happens because
name_valuereturnsupdate_toolfor both classes.Expected behavior
We should probably use a more robust key here to properly handle this case. I could open a PR if needed and adapt the tests, but let me know first what you think about it!
Thanks for this gem! 🙌