-
Notifications
You must be signed in to change notification settings - Fork 47
Always get latest tools #42
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
Conversation
- make atool async - add sync start() method - add refresh tools logic
|
hey @joejoe2 thanks a lot for the work and pushing for this I think this is a great change. Could we add 2 tests for the sync and async mode where the tools would change between the two calls on the server with a dummy adapter? |
ok, I will add them |
|
@grll Plz check again, thanks ! |
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.
Thanks for the tests I think it's exactly what we need, I am just a bit sad about the fact that we need to wait 10seconds for it. Do you think we could call the update_tool function / mcp.add_tool() in the test and reduce as much as possible the wait time? something in the test like:
# 1. assert initial tools
# 2. run mcp.add_tool
# 3. (here I am afraid we might have to wait a bit unless we could block the program until the add_tool is done?)
# 4. assert initial tools + new tools
What do you think?
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.
Seems like the server script is run in another process by uv. Any idea to achieve this ? I cannot come up an easy way.
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.
Maybe just move mcp.add_tool() into the initial tool. Also the add_tool() will not take effect for exsisting tool.
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.
I think the simplest to achieve this would be to create a tool on the server "add_tool" which effectively adds a new tool to the MCP server that way we could call that tool in the test to add the tool on the MCP. I think it could work no?
|
Prevent sleep in test works ! |
grll
left a comment
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.
great thanks!
* always get latest tools - make atool async - add sync start() method - add refresh tools logic * remove unused import * add tests for refresh tools in sync/async ctx * prevent sleep in tests
refer to #33