-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fastmcp: allow passing Tool directly to FastMCP constructor #699
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?
fastmcp: allow passing Tool directly to FastMCP constructor #699
Conversation
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 am okay with the general idea of allowing the registration of a Tool instance directly. However, I personally prefer using a separate function name over an overload, since the overload leads to add_tool
having a very funky type signature. I personally would prefer if we add a add_tool_instance
function instead. Would love to hear @Kludex or @ihrpr's opinion on the matter.
sounds good - I will add a separate method! |
It does not. I think the |
…hon-sdk into vb/allow-adding-tool-directly
Thanks for the feedback - I agree that it's cleaner to put it in the constructor. Updated! |
This change allows passing the FastMCP
Tool
instance directly via a newfastmcp_server.add_tool_instance
method.This is useful if someone needs to construct the
Tool
instance manually, without inspecting a function. For example, this can be used to convert LangChain tools to FastMCP-compatible tools and add those to an existing FastMCP server.